Meta-ecosystems have been studied looking at meta-ecosystems in which patch size was the same. However, of course, we know that meta-ecosystems are mad out of patches that have different size. To see the effects of patch size on meta-ecosystem properties, we ran a four weeks protist experiment in which different ecosystems were connected through the flow of nutrients. The flow of nutrients resulted from a perturbation of the ecosystems in which a fixed part of the cultures was boiled and then poored into the receiving patch. This had a fixed volume (e.g., small perturbation = 6.75 ml) and was the same across all patch sizes. The experiment design consisted in crossing two disturbances with a small, medium, and large isolated ecosystems and with a small-small, medium-medium, large-large, and small-large meta-ecosystem. We took videos every four days and we create this perturbation and resource flow the day after taking videos. We skipped the perturbation the day after we assembled the experiment so that we would start perturbing it when population densities were already high.
We had mainly two research questions:
Do patch properties of a patch depend upon the size of the patch it is connected to?
Do metaecosystem properties of a meta-ecosystem depend upon the relative size of its patch?
23/3/22 PPM for increasing the number of monocultures in the collection.
24/3/22 Collection control. See monoculture maintenance lab book p. 47.
26/3/22 Increase of number of monocultures in the collection. To do so, take the best culture and make 3 new ones. See monoculture maintenance lab book p. 47.
1/4/22 Make PPM for high density monocultures. See PatchSizePilot lab book p. 5.
3/4/22 Make bacterial solution for high density monocultures. See PatchSizePilot lab book p. 8.
5/4/22 Grow high density monocultures. Make 3 high density monocultures for each protist species with 200 ml with 5% bacterial solution, 85% PPM, 10% protists, and 2 seeds. See PatchSizePilot lab book p. 10
10/4/2022 Check high density monocultures. Cep, Eup, Spi, Spi te were really low.
13/4/2022 Start of the experiment. See PatchSizePilot p. 33.
- Autoclave all the material in advance
- Get more high-density monocultures
- Decide in advance the days in which you are going to check the high-density monocultures and prepare bacteria in advance for that day so that if some of them crashed you are still on time to make new ones.
- Use a single lab book for also when you create PPM and check the collection.
- Make a really high amount of PPM, as you will need for so many different things (>10 L). Maybe also autoclave 1 L Schott bottles so that you don’t have to oxygenate whole 5 L bottles of PPM. I think that I should have maybe made even a 10 L bottle of PPM.
- According to Silvana protists take 4-7 days to grow. The fastest is Tet (ca 4 days) and the slowest is Spi (ca 7 days). Once that you grow them they should stay at carrying capacity for a bit of time I guess, as you can see in the monoculture collection. I should make sure I’m growing them in the right way. I think that maybe I should grow them 10 days in advance so that I could actually grow also the slow species if they crashed. What should I do if all of them crashed?
To build the mixed effect models we will use the R package lme4. See page 6 of this PDF to know more about the syntaxis of this package and this link for the interaction syntaxis.
To do model diagnostics of mixed effect models, I’m going to look at the following two plots (as suggested by Zuur et al. (2009), page 487):
Quantile-quantile plots (plot(mixed_model))
Partial residual plots
(qqnorm(resid(mixed_model)))
The effect size of the explaining variables is calculated in the
mixed effect models as marginal and conditional r squared. The marginal
r squared is how much variance is explained by the fixed effects. The
conditional r squared is how much variance is explained by the fixed and
the random effects. The marginal and conditional r squared are
calculated using the package MuMIn. The computation is
based on the methods of Nakagawa, Johnson, and
Schielzeth (2017). For the coding and interpretation of these r
squared check the documentation
for the r.squaredGLMM function
Time can be included as a fixed or random effect. Time can be included as a random effect if the different data points are non independent from each other (e.g., seasons). However, because the biomass in our experiment was following a temporal trend, the different time points show autocorrelation. In other words, t2 is more similar to t3 than t4 and so on. This is why we decided to include time as a fixed effect. For an excellent discussion on this topic see this blog post.
Interactions (here refers to how biomass changes across different patch types, but it’s the same for meta-ecosystem type and other response variables)
Day * Patch Type = biomass changes in different ways in different ecosystem types. Yes.
Day * Disturbance = disturbance has a different effect at different days. Yes.
Patch Type * Disturbance = disturbance has a different effect on different patch types. Yes.
I am going to select the best model according to AIC. Halsey (2019) suggests this approach instead of p values. P-values are not a reliable way of choosing a model because:
My sample size is small, producing larger p-values
P-values are really variable, creating many false positives and negatives (e.g., if p=0.05 there is a 1 in 3 chance that it’s a false positive)
To study the patch biomass how it changes across treatments, we
could have made three different models between the three combinations of
small patches. However, that might be confusing to interpret the
results. We decided instead to use an effect size where we control is
the isolated small patch. At the beginning we thought to use the natural
logarithm of the response ratio (lnRR). The problem, however, is that
some bioarea values were 0. We were thinking to add 1 to all null
values, but according to Rosenberg, Rothstein,
and Gurevitch (2013), such practice inflates effect sizes.
Because of this, I looked into other types of effect size. I found that
the most common and preferred metric in use today is known as Hedge’s d
(a.k.a. Hedge’s g) (Hedges and Olkin
(1985) ). It is calculated as the difference in mean between
treatment and control divided by the standard deviation of the pooled
data. Another measure would be Cohen’s d, but it underperforms with
sample sizes that are lower than 20 (StatisticsHowTo). I
can easily calculate the Hedge’s d using the r package
effsize.
Same thing for the large patches.
Single time points cannot be computed for effect sizes just because I have a single data point as response variable (e.g., one for S (S_S) at low disturbance at time point = 2). It would have been nice to show the difference in treatments at specific time points visually through confidence intervals. However, the confidence interval cannot be computed for the last two time points because there are too many zeros and their confidence interval computation produces a lot of Nan, Inf, and -Inf. At this point it doesn’t make sense to show just a subset of time points and we decided to opt out from the visualisation of confidence intervals.
To calcula the 95% CI of the abundance of different size classes I used the following code: https://stackoverflow.com/questions/35953394/calculating-length-of-95-ci-using-dplyr, whose formula can be found here: https://courses.lumenlearning.com/introstats1/chapter/a-single-population-mean-using-the-student-t-distribution/
\[ CI_{lower} = mean - (t \: score * \frac{SD}{sample \: size}) \] \[ CI_{upper} = mean + (t \: score * \frac{SD}{sample \: size}) \]
where the t-score is computed from the student t distribution using the r function qt with percentile = 0.975 and degrees of freedom = sample size - 1.
Hedge’s d ± 95 CI = d ± 1.96*SE
See HEDGES G CONFIDENCE LIMIT (nist.gov), meta analysis - Calculate effect size and confidence interval from published means±std - Cross Validated (stackexchange.com).
\[ SE_g = \sqrt{V_g} \]
\[ V_g = J^2 * V_d \]
\[ J = 1 - \frac{3}{4df-1} \]
\[ V_d = \frac{n1 + n2}{n_1 n_2} + \frac{d^2}{2(n_1 + n_2)} \]
d = Hedge’s d
n1 = sample size of group 1
n2 = sample size of group 2
df = degrees of freedom (df = n1 + n2 - 2)
See https://www.meta-analysis.com/downloads/Meta-analysis%20Effect%20sizes%20based%20on%20means.pdf
According to this post on stackoverflow it’s not possible to build a model
where there is the interaction between a factor and a continuous
variable with having the factor as main variable. This is because of the
function model.matrix.default. Therefore, I’m going to test
the effects of day by taking off also the interaction term between
day and eco_metaeco_type.
I thought I might look into how to better choose the nr of size classes. In (Loder1997?) it says that they have no idea how to do that. I will then just look into how to best choose the number of histragram plots.
culture_info)This table contains information about the 110 cultures of the experiment.
culture_info = read.csv(here("data", "PatchSizePilot_culture_info.csv"), header = TRUE)
datatable(culture_info[,1:10],
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_patches)#Import data
load(here("data", "population", "t0.RData"))
t0 = pop_output
load(here("data", "population", "t1.RData"))
t1 = pop_output
load(here("data", "population", "t2.RData"))
t2 = pop_output
load(here("data", "population", "t3.RData"))
t3 = pop_output
load(here("data", "population", "t4.RData"))
t4 = pop_output
load(here("data", "population", "t5.RData"))
t5 = pop_output
load(here("data", "population", "t6.RData"))
t6 = pop_output
load(here("data", "population", "t7.RData"))
t7 = pop_output
rm(pop_output)
species_ID_t0 = read.csv(here("data", "population_species_ID", "species_ID_t0.csv")) %>%
select(file, Ble:Tet)
species_ID_t1 = read.csv(here("data", "population_species_ID", "species_ID_t1.csv")) %>%
select(file, Ble:Tet)
species_ID_t2 = read.csv(here("data", "population_species_ID", "species_ID_t2.csv")) %>%
select(file, Ble:Tet)
species_ID_t3 = read.csv(here("data", "population_species_ID", "species_ID_t3.csv")) %>%
select(file, Ble:Tet)
species_ID_t4 = read.csv(here("data", "population_species_ID", "species_ID_t4.csv")) %>%
select(file, Ble:Tet)
species_ID_t5 = read.csv(here("data", "population_species_ID", "species_ID_t5.csv")) %>%
select(file, Ble:Tet)
species_ID_t6 = read.csv(here("data", "population_species_ID", "species_ID_t6.csv")) %>%
select(file, Ble:Tet)
species_ID_t7 = read.csv(here("data", "population_species_ID", "species_ID_t7.csv")) %>%
select(file, Ble:Tet)
t0 = merge(t0, species_ID_t0, by = "file")
t1 = merge(t1, species_ID_t1, by = "file")
t2 = merge(t2, species_ID_t2, by = "file")
t3 = merge(t3, species_ID_t3, by = "file")
t4 = merge(t4, species_ID_t4, by = "file")
t5 = merge(t5, species_ID_t5, by = "file")
t6 = merge(t6, species_ID_t6, by = "file")
t7 = merge(t7, species_ID_t7, by = "file")
rm(
species_ID_t0,
species_ID_t1,
species_ID_t2,
species_ID_t3,
species_ID_t4,
species_ID_t5,
species_ID_t6,
species_ID_t7
)
#Manipulate the columns "time" & "replicate_video"
t2$time = NULL
t3$time = NULL
t4$time = NULL
t5$time = NULL
t6$time = NULL
t7$time = NULL
t0$replicate_video = 1:12 #In t1 I took 12 videos of a single
t1$replicate_video = 1 #In t1 I took only 1 video/culture
t2$replicate_video = 1 #In t2 I took only 1 video/culture
t3$replicate_video = 1 #In t3 I took only 1 video/culture
t4$replicate_video = 1 #In t4 I took only 1 video/culture
t5$replicate_video = 1 #In t5 I took only 1 video/culture
t6$replicate_video = t6$replicate
t6$replicate = NULL
t7$replicate_video = t7$replicate
t7$replicate = NULL
#Elongate t0 so that it can be joined with the information about the cultures.
number_of_columns_t0 = ncol(t0)
nr_of_cultures = nrow(culture_info)
nr_of_videos = nrow(t0)
t0 = t0[rep(row.names(t0),
nr_of_cultures), ] %>%
arrange(file) %>%
mutate(culture_ID = rep(1:nr_of_cultures,
times = nr_of_videos))
#Merge time points
t0 = merge(culture_info, t0, by = "culture_ID")
t1 = merge(culture_info, t1, by = "culture_ID")
t2 = merge(culture_info, t2, by = "culture_ID")
t3 = merge(culture_info, t3, by = "culture_ID")
t4 = merge(culture_info, t4, by = "culture_ID")
t5 = merge(culture_info, t5, by = "culture_ID")
t6 = merge(culture_info, t6, by = "culture_ID")
t7 = merge(culture_info, t7, by = "culture_ID")
ds_patches = rbind(t0, t1, t2, t3, t4, t5, t6, t7)
rm(t0, t1, t2, t3, t4, t5, t6, t7)
#Tidy dataset.
ds_patches = ds_patches %>%
filter(! culture_ID %in% ecosystems_to_take_off)
ds_patches$time_point[ds_patches$time_point=="t0"] = 0
ds_patches$time_point[ds_patches$time_point=="t1"] = 1
ds_patches$time_point[ds_patches$time_point=="t2"] = 2
ds_patches$time_point[ds_patches$time_point=="t3"] = 3
ds_patches$time_point[ds_patches$time_point=="t4"] = 4
ds_patches$time_point[ds_patches$time_point=="t5"] = 5
ds_patches$time_point[ds_patches$time_point=="t6"] = 6
ds_patches$time_point[ds_patches$time_point=="t7"] = 7
ds_patches$time_point = as.character(ds_patches$time_point)
ds_patches$day = NA
ds_patches$day[ds_patches$time_point== 0] = 0
ds_patches$day[ds_patches$time_point== 1] = 4
ds_patches$day[ds_patches$time_point== 2] = 8
ds_patches$day[ds_patches$time_point== 3] = 12
ds_patches$day[ds_patches$time_point== 4] = 16
ds_patches$day[ds_patches$time_point== 5] = 20
ds_patches$day[ds_patches$time_point== 6] = 24
ds_patches$day[ds_patches$time_point== 7] = 28
ds_for_evaporation = ds_patches #Keep this dataset for the evaporation effects
### Average videos
ds_patches = ds_patches %>%
group_by(
culture_ID,
patch_size,
patch_size_volume,
disturbance,
metaecosystem_type,
time_point,
day,
metaecosystem,
system_nr,
eco_metaeco_type
) %>%
summarise(
bioarea_per_volume = mean(bioarea_per_volume),
indiv_per_volume = mean(indiv_per_volume),
Ble = mean(Ble),
Cep = mean(Cep),
Col = mean(Col),
Eug = mean(Eug),
Eup = mean(Eup),
Lox = mean(Lox),
Pau = mean(Pau),
Pca = mean(Pca),
Spi = mean(Spi),
Spi_te = mean(Spi_te),
Tet = mean(Tet)
) %>%
ungroup()
#Change all the measures to ml
#bioarea_per_volume in the original data is in µm2 / µl -> convert to µm2 / ml
#indiv_per_volume & all protists in the original data are in individuals / µl -> convert to individuals / ml
ds_patches = ds_patches %>%
mutate(bioarea_per_volume = bioarea_per_volume * 1000,
bioarea_tot = bioarea_per_volume * patch_size_volume,
indiv_per_volume = indiv_per_volume * 1000,
indiv_tot = indiv_per_volume * patch_size_volume,
Ble = Ble * 1000,
Cep = Cep * 1000,
Col = Col * 1000,
Eug = Eug * 1000,
Eup = Eup * 1000,
Lox = Lox * 1000,
Pau = Pau * 1000,
Pca = Pca * 1000,
Spi = Spi * 1000,
Spi_te = Spi_te * 1000,
Tet = Tet * 1000,
Ble_tot = Ble * patch_size_volume,
Cep_tot = Cep * patch_size_volume,
Col_tot = Col * patch_size_volume,
Eug_tot = Eug * patch_size_volume,
Eup_tot = Eup * patch_size_volume,
Lox_tot = Lox * patch_size_volume,
Pau_tot = Pau * patch_size_volume,
Pca_tot = Pca * patch_size_volume,
Spi_tot = Spi * patch_size_volume,
Spi_te_tot = Spi_te * patch_size_volume,
Tet_tot = Tet * patch_size_volume)
# Calculate species richness
ds_patches = ds_patches %>%
mutate(Ble_presence = case_when(Ble > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Cep_presence = case_when(Cep > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Col_presence = case_when(Col > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Eug_presence = case_when(Eup > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Eup_presence = case_when(Eug > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Lox_presence = case_when(Lox > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Pau_presence = case_when(Pau > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Pca_presence = case_when(Pca > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Spi_presence = case_when(Spi > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Spi_te_presence = case_when(Spi_te > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(Tet_presence = case_when(Tet > 0 ~ 1,
TRUE ~ 0)) %>%
mutate(species_richness = Ble_presence +
Cep_presence +
Col_presence +
Eug_presence +
Eup_presence +
Lox_presence +
Pau_presence +
Pca_presence +
Spi_presence +
Spi_te_presence +
Tet_presence) %>%
select(-one_of(
c(
"Ble_presence",
"Cep_presence",
"Col_presence",
"Eug_presence",
"Eup_presence",
"Lox_presence",
"Pau_presence",
"Pca_presence",
"Spi_presence",
"Spi_te_presence",
"Tet_presence"
)
))
#Calculate alpha diversity (shannon, simpson, inv simpson)
ds_patches$shannon = NA
ds_patches$simpson = NA
ds_patches$inv_simpson = NA
for (row in 1:nrow(ds_patches)){
species_vector = ds_patches %>%
slice(row) %>%
select(Ble:Tet)
shannon = diversity(species_vector, index = "shannon")
simpson = diversity(species_vector, index = "simpson")
inv_simpson = diversity(species_vector, index = "invsimpson")
ds_patches[row,]$shannon = shannon
ds_patches[row,]$simpson = simpson
ds_patches[row,]$inv_simpson = inv_simpson
}
#Add baselines (from t1).
baselines = ds_patches %>%
filter(time_point == 1) %>%
group_by(culture_ID) %>%
summarise(bioarea_per_volume_across_videos = mean(bioarea_per_volume),
indiv_per_volume_across_videos = mean(indiv_per_volume),
species_richness_across_videos = mean(species_richness),
shannon_across_videos = mean(shannon),
Ble_across_videos = mean(Ble),
Cep_across_videos = mean(Cep),
Col_across_videos = mean(Col),
Eug_across_videos = mean(Eug),
Eup_across_videos = mean(Eup),
Lox_across_videos = mean(Lox),
Pau_across_videos = mean(Pau),
Pca_across_videos = mean(Pca),
Spi_across_videos = mean(Spi),
Spi_te_across_videos = mean(Spi_te),
Tet_across_videos = mean(Tet)) %>%
rename(baseline_bioarea = bioarea_per_volume_across_videos,
baseline_indiv_per_volume = indiv_per_volume_across_videos,
baseline_species_richness = species_richness_across_videos,
baseline_shannon = shannon_across_videos,
baseline_Ble = Ble_across_videos,
baseline_Cep = Cep_across_videos,
baseline_Col = Col_across_videos,
baseline_Eug = Eug_across_videos,
baseline_Eup = Eup_across_videos,
baseline_Lox = Lox_across_videos,
baseline_Pau = Pau_across_videos,
baseline_Pca = Pca_across_videos,
baseline_Spi = Spi_across_videos,
baseline_Spi_te = Spi_te_across_videos,
baseline_Tet = Tet_across_videos)
ds_patches = full_join(ds_patches, baselines)
saveRDS(ds_for_evaporation, file = here("results", "ds_for_evaporation.RData"))
saveRDS(ds_patches, file = here("results", "ds_patches.RData"))
datatable(ds_patches,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_patches_effect_size)ds_patches_effect_size = ds_patches %>%
group_by(
culture_ID,
system_nr,
disturbance,
time_point,
day,
patch_size,
eco_metaeco_type
) %>%
summarise(
baseline_bioarea_across_videos = mean(baseline_bioarea),
baseline_indiv_per_volume_across_videos = mean(baseline_bioarea),
baseline_species_richness_across_videos = mean(baseline_species_richness),
baseline_shannon_across_videos = mean(baseline_shannon),
baseline_Ble_across_videos = mean(baseline_Ble),
baseline_Cep_across_videos = mean(baseline_Cep),
baseline_Col_across_videos = mean(baseline_Col),
baseline_Eug_across_videos = mean(baseline_Eug),
baseline_Eup_across_videos = mean(baseline_Eup),
baseline_Lox_across_videos = mean(baseline_Lox),
baseline_Pau_across_videos = mean(baseline_Pau),
baseline_Pca_across_videos = mean(baseline_Pca),
baseline_Spi_across_videos = mean(baseline_Spi),
baseline_Spi_te_across_videos = mean(baseline_Spi_te),
baseline_Tet_across_videos = mean(baseline_Tet),
bioarea_per_volume_across_videos = mean(bioarea_per_volume),
indiv_per_volume_across_videos = mean(indiv_per_volume),
species_richness_across_videos = max(species_richness),
shannon_across_videos = mean(shannon),
Ble_across_videos = mean(Ble),
Cep_across_videos = mean(Cep),
Col_across_videos = mean(Col),
Eug_across_videos = mean(Eug),
Eup_across_videos = mean(Eup),
Lox_across_videos = mean(Lox),
Pau_across_videos = mean(Pau),
Pca_across_videos = mean(Pca),
Spi_across_videos = mean(Spi),
Spi_te_across_videos = mean(Spi_te),
Tet_across_videos = mean(Tet)
) %>%
group_by(disturbance,
eco_metaeco_type,
patch_size,
time_point,
day) %>%
summarise(
sample_size = n(),
baseline_bioarea = mean(baseline_bioarea_across_videos),
baseline_indiv_per_volume = mean(indiv_per_volume_across_videos),
baseline_species_richness = mean(species_richness_across_videos),
baseline_shannon = mean(shannon_across_videos),
baseline_Ble = mean(Ble_across_videos),
baseline_Cep = mean(Cep_across_videos),
baseline_Col = mean(Col_across_videos),
baseline_Eug = mean(Eug_across_videos),
baseline_Eup = mean(Eup_across_videos),
baseline_Lox = mean(Lox_across_videos),
baseline_Pau = mean(Pau_across_videos),
baseline_Pca = mean(Pca_across_videos),
baseline_Spi = mean(Spi_across_videos),
baseline_Spi_te = mean(Spi_te_across_videos),
baseline_Tet = mean(Tet_across_videos),
bioarea_per_volume_mean = mean(bioarea_per_volume_across_videos),
bioarea_per_volume_sd = sd(bioarea_per_volume_across_videos),
indiv_per_volume_mean = mean(indiv_per_volume_across_videos),
indiv_per_volume_sd = sd(indiv_per_volume_across_videos),
species_richness_mean = mean(species_richness_across_videos),
species_richness_sd = sd(species_richness_across_videos),
shannon_mean = mean(shannon_across_videos),
shannon_sd = sd(shannon_across_videos),
Ble_mean = mean(Ble_across_videos),
Ble_sd = sd(Ble_across_videos),
Cep_mean = mean(Cep_across_videos),
Cep_sd = sd(Cep_across_videos),
Col_mean = mean(Col_across_videos),
Col_sd = sd(Col_across_videos),
Eug_mean = mean(Eug_across_videos),
Eug_sd = sd(Eug_across_videos),
Eup_mean = mean(Eup_across_videos),
Eup_sd = sd(Eup_across_videos),
Lox_mean = mean(Lox_across_videos),
Lox_sd = sd(Lox_across_videos),
Pau_mean = mean(Pau_across_videos),
Pau_sd = sd(Pau_across_videos),
Pca_mean = mean(Pca_across_videos),
Pca_sd = sd(Pca_across_videos),
Spi_mean = mean(Spi_across_videos),
Spi_sd = sd(Spi_across_videos),
Spi_te_mean = mean(Spi_te_across_videos),
Spi_te_sd = sd(Spi_te_across_videos),
Tet_mean = mean(Tet_across_videos),
Tet_sd = sd(Tet_across_videos)
) %>% #Initialise columns
mutate(bioarea_per_volume_d = NA,
bioarea_per_volume_d_upper = NA,
bioarea_per_volume_d_lower = NA,
bioarea_per_volume_lnRR = NA,
indiv_per_volume_d = NA,
indiv_per_volume_d_upper = NA,
indiv_per_volume_d_lower = NA,
indiv_per_volume_lnRR = NA,
species_richness_d = NA,
species_richness_d_upper = NA,
species_richness_d_lower = NA,
species_richness_lnRR = NA,
shannon_d = NA,
shannon_d_upper = NA,
shannon_d_lower = NA,
shannon_lnRR = NA,
Ble_d = NA,
Cep_d = NA,
Col_d = NA,
Eug_d = NA,
Eup_d = NA,
Lox_d = NA,
Pau_d = NA,
Pca_d = NA,
Spi_d = NA,
Spi_te_d = NA,
Tet_d = NA,
Ble_d_upper = NA,
Ble_d_lower = NA,
Ble_lnRR = NA,
Cep_d_upper = NA,
Cep_d_lower = NA,
Cep_lnRR = NA,
Col_d_upper = NA,
Col_d_lower = NA,
Col_lnRR = NA,
Eug_d_upper = NA,
Eug_d_lower = NA,
Eug_lnRR = NA,
Eup_d_upper = NA,
Eup_d_lower = NA,
Eup_lnRR = NA,
Lox_d_upper = NA,
Lox_d_lower = NA,
Lox_lnRR = NA,
Pau_d_upper = NA,
Pau_d_lower = NA,
Pau_lnRR = NA,
Pca_d_upper = NA,
Pca_d_lower = NA,
Pca_lnRR = NA,
Spi_d_upper = NA,
Spi_d_lower = NA,
Spi_lnRR = NA,
Spi_te_d_upper = NA,
Spi_te_d_lower = NA,
Spi_te_lnRR = NA,
Tet_d_upper = NA,
Tet_d_lower = NA,
Tet_lnRR = NA)
treatments_and_controls = data.frame(
treatment = c("S (S_S)", "S (S_L)", "M (M_M)", "L (L_L)", "L (S_L)"),
control = c("S", "S", "M", "L", "L")
)
n_of_treatments = nrow(treatments_and_controls)
row_n = 0
for (disturbance_input in c("low", "high")) {
for (treatment_n in 1:n_of_treatments) {
for (time_point_input in 0:7) {
row_n = row_n + 1
eco_metaeco_treatment = treatments_and_controls$treatment[treatment_n]
treatment_row = ds_patches_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_treatment,
time_point == time_point_input
)
eco_metaeco_control = treatments_and_controls$control[treatment_n]
control_row = ds_patches_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_control,
time_point == time_point_input
)
### Bioarea density
hedges_d_bioarea = calculate.hedges_d(
treatment_row$bioarea_per_volume_mean,
treatment_row$bioarea_per_volume_sd,
treatment_row$sample_size,
control_row$bioarea_per_volume_mean,
control_row$bioarea_per_volume_sd,
control_row$sample_size
)
ds_patches_effect_size$bioarea_per_volume_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$d
ds_patches_effect_size$bioarea_per_volume_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$upper_CI
ds_patches_effect_size$bioarea_per_volume_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_bioarea$lower_CI
ds_patches_effect_size$bioarea_per_volume_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$bioarea_per_volume_mean / control_row$bioarea_per_volume_mean)
### Individuals per volume
hedges_d_indiv_per_volume = calculate.hedges_d(
treatment_row$indiv_per_volume_mean,
treatment_row$indiv_per_volume_sd,
treatment_row$sample_size,
control_row$indiv_per_volume_mean,
control_row$indiv_per_volume_sd,
control_row$sample_size
)
ds_patches_effect_size$indiv_per_volume_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$d
ds_patches_effect_size$indiv_per_volume_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$lower_CI
ds_patches_effect_size$indiv_per_volume_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_indiv_per_volume$upper_CI
ds_patches_effect_size$indiv_per_volume_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$indiv_per_volume_mean / control_row$indiv_per_volume_mean)
### Species richness
hedges_d_species_richness = calculate.hedges_d(
treatment_row$species_richness_mean,
treatment_row$species_richness_sd,
treatment_row$sample_size,
control_row$species_richness_mean,
control_row$species_richness_sd,
control_row$sample_size
)
ds_patches_effect_size$species_richness_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$d
ds_patches_effect_size$species_richness_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$upper_CI
ds_patches_effect_size$species_richness_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_species_richness$lower_CI
ds_patches_effect_size$species_richness_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$species_richness_mean / control_row$species_richness_mean)
### Shannon Index
hedges_d_shannon = calculate.hedges_d(
treatment_row$shannon_mean,
treatment_row$shannon_sd,
treatment_row$sample_size,
control_row$shannon_mean,
control_row$shannon_sd,
control_row$sample_size
)
ds_patches_effect_size$shannon_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$d
ds_patches_effect_size$shannon_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$upper_CI
ds_patches_effect_size$shannon_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_shannon$lower_CI
ds_patches_effect_size$shannon_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$shannon_mean / control_row$shannon_mean)
### Ble
hedges_d_Ble = calculate.hedges_d(
treatment_row$Ble_mean,
treatment_row$Ble_sd,
treatment_row$sample_size,
control_row$Ble_mean,
control_row$Ble_sd,
control_row$sample_size
)
ds_patches_effect_size$Ble_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$d
ds_patches_effect_size$Ble_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$lower_CI
ds_patches_effect_size$Ble_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Ble$upper_CI
ds_patches_effect_size$Ble_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Ble_mean / control_row$Ble_mean)
### Cep
hedges_d_Cep = calculate.hedges_d(
treatment_row$Cep_mean,
treatment_row$Cep_sd,
treatment_row$sample_size,
control_row$Cep_mean,
control_row$Cep_sd,
control_row$sample_size
)
ds_patches_effect_size$Cep_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$d
ds_patches_effect_size$Cep_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$lower_CI
ds_patches_effect_size$Cep_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Cep$upper_CI
ds_patches_effect_size$Cep_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Cep_mean / control_row$Cep_mean)
### Col
hedges_d_Col = calculate.hedges_d(
treatment_row$Col_mean,
treatment_row$Col_sd,
treatment_row$sample_size,
control_row$Col_mean,
control_row$Col_sd,
control_row$sample_size
)
ds_patches_effect_size$Col_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$d
ds_patches_effect_size$Col_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$lower_CI
ds_patches_effect_size$Col_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Col$upper_CI
ds_patches_effect_size$Col_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Col_mean / control_row$Col_mean)
### Eug
hedges_d_Eug = calculate.hedges_d(
treatment_row$Eug_mean,
treatment_row$Eug_sd,
treatment_row$sample_size,
control_row$Eug_mean,
control_row$Eug_sd,
control_row$sample_size
)
ds_patches_effect_size$Eug_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$d
ds_patches_effect_size$Eug_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$lower_CI
ds_patches_effect_size$Eug_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eug$upper_CI
ds_patches_effect_size$Eug_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Eug_mean / control_row$Eug_mean)
### Eup
hedges_d_Eup = calculate.hedges_d(
treatment_row$Eup_mean,
treatment_row$Eup_sd,
treatment_row$sample_size,
control_row$Eup_mean,
control_row$Eup_sd,
control_row$sample_size
)
ds_patches_effect_size$Eup_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$d
ds_patches_effect_size$Eup_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$lower_CI
ds_patches_effect_size$Eup_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Eup$upper_CI
ds_patches_effect_size$Eup_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Eup_mean / control_row$Eup_mean)
### Lox
hedges_d_Lox = calculate.hedges_d(
treatment_row$Lox_mean,
treatment_row$Lox_sd,
treatment_row$sample_size,
control_row$Lox_mean,
control_row$Lox_sd,
control_row$sample_size
)
ds_patches_effect_size$Lox_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$d
ds_patches_effect_size$Lox_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$lower_CI
ds_patches_effect_size$Lox_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Lox$upper_CI
ds_patches_effect_size$Lox_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Lox_mean / control_row$Lox_mean)
### Pau
hedges_d_Pau = calculate.hedges_d(
treatment_row$Pau_mean,
treatment_row$Pau_sd,
treatment_row$sample_size,
control_row$Pau_mean,
control_row$Pau_sd,
control_row$sample_size
)
ds_patches_effect_size$Pau_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$d
ds_patches_effect_size$Pau_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$lower_CI
ds_patches_effect_size$Pau_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pau$upper_CI
ds_patches_effect_size$Pau_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Pau_mean / control_row$Pau_mean)
### Pca
hedges_d_Pca = calculate.hedges_d(
treatment_row$Pca_mean,
treatment_row$Pca_sd,
treatment_row$sample_size,
control_row$Pca_mean,
control_row$Pca_sd,
control_row$sample_size
)
ds_patches_effect_size$Pca_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$d
ds_patches_effect_size$Pca_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$lower_CI
ds_patches_effect_size$Pca_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Pca$upper_CI
ds_patches_effect_size$Pca_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Pca_mean / control_row$Pca_mean)
### Spi
hedges_d_Spi = calculate.hedges_d(
treatment_row$Spi_mean,
treatment_row$Spi_sd,
treatment_row$sample_size,
control_row$Spi_mean,
control_row$Spi_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$d
ds_patches_effect_size$Spi_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$lower_CI
ds_patches_effect_size$Spi_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi$upper_CI
ds_patches_effect_size$Spi_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Spi_mean / control_row$Spi_mean)
### Spi te
hedges_d_Spi_te = calculate.hedges_d(
treatment_row$Spi_te_mean,
treatment_row$Spi_te_sd,
treatment_row$sample_size,
control_row$Spi_te_mean,
control_row$Spi_te_sd,
control_row$sample_size
)
ds_patches_effect_size$Spi_te_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$d
ds_patches_effect_size$Spi_te_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$lower_CI
ds_patches_effect_size$Spi_te_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Spi_te$upper_CI
ds_patches_effect_size$Spi_te_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Spi_te_mean / control_row$Spi_te_mean)
### Tet
hedges_d_Tet = calculate.hedges_d(
treatment_row$Tet_mean,
treatment_row$Tet_sd,
treatment_row$sample_size,
control_row$Tet_mean,
control_row$Tet_sd,
control_row$sample_size
)
ds_patches_effect_size$Tet_d[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$d
ds_patches_effect_size$Tet_d_lower[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$lower_CI
ds_patches_effect_size$Tet_d_upper[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
hedges_d_Tet$upper_CI
ds_patches_effect_size$Tet_lnRR[
ds_patches_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_patches_effect_size$time_point == time_point_input &
ds_patches_effect_size$disturbance == disturbance_input] =
ln(treatment_row$Tet_mean / control_row$Tet_mean)
}
}
}
saveRDS(ds_patches_effect_size, file = here("results", "ds_patches_effect_size.RData"))
datatable(ds_patches_effect_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_metaecosystems)Each row is a meta-ecosystem.
It contains also “fake” meta-ecosystems which I created from
isolated patches
(metecosystem type = S_L_from_isolated).
#Create ds_metaecosystems
ds_metaecosystems = ds_patches %>%
filter(metaecosystem == "yes",
!system_nr %in% metaecosystems_to_take_off) %>%
group_by(system_nr,
time_point,
disturbance,
metaecosystem_type,
day) %>%
summarise(total_metaecosystem_bioarea = sum(bioarea_tot),
total_metaecosystem_Ble = sum(Ble_tot),
total_metaecosystem_Cep = sum(Cep_tot),
total_metaecosystem_Col = sum(Col_tot),
total_metaecosystem_Eug = sum(Eug_tot),
total_metaecosystem_Eup = sum(Eup_tot),
total_metaecosystem_Lox = sum(Lox_tot),
total_metaecosystem_Pau = sum(Pau_tot),
total_metaecosystem_Pca = sum(Pca_tot),
total_metaecosystem_Spi = sum(Spi_tot),
total_metaecosystem_Spi_te = sum(Spi_te_tot),
total_metaecosystem_Tet = sum(Tet_tot))
### Add "Small-Large from isolated" to the metaecosystem dataset
culture_ID_of_isolated_S_low = ds_patches %>%
filter(eco_metaeco_type == "S",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_L_low = ds_patches %>%
filter(eco_metaeco_type == "L",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_S_high = ds_patches %>%
filter(eco_metaeco_type == "S",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_L_high = ds_patches %>%
filter(eco_metaeco_type == "L",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
combinations_S_and_L_low = crossing(culture_ID_of_isolated_S_low,
culture_ID_of_isolated_L_low) %>%
mutate(disturbance = "low") %>%
rename(ID_S = culture_ID_of_isolated_S_low,
ID_L = culture_ID_of_isolated_L_low)
combinations_S_and_L_high = crossing(culture_ID_of_isolated_S_high,
culture_ID_of_isolated_L_high) %>%
mutate(disturbance = "high") %>%
rename(ID_S = culture_ID_of_isolated_S_high,
ID_L = culture_ID_of_isolated_L_high)
combinations_of_S_and_L = rbind(combinations_S_and_L_low,
combinations_S_and_L_high)
number_of_combinations_of_S_and_L = nrow(combinations_of_S_and_L)
SL_from_isolated_single_rows = NULL
for (combination in 1:number_of_combinations_of_S_and_L){
SL_from_isolated_single_rows[[combination]] = ds_patches %>%
filter(culture_ID %in% combinations_of_S_and_L[combination,]) %>%
group_by(day,
time_point) %>%
summarise(total_metaecosystem_bioarea = sum(bioarea_tot),
total_metaecosystem_Ble = sum(Ble_tot),
total_metaecosystem_Cep = sum(Cep_tot),
total_metaecosystem_Col = sum(Col_tot),
total_metaecosystem_Eug = sum(Eug_tot),
total_metaecosystem_Eup = sum(Eup_tot),
total_metaecosystem_Lox = sum(Lox_tot),
total_metaecosystem_Pau = sum(Pau_tot),
total_metaecosystem_Pca = sum(Pca_tot),
total_metaecosystem_Spi = sum(Spi_tot),
total_metaecosystem_Spi_te = sum(Spi_te_tot),
total_metaecosystem_Tet = sum(Tet_tot)) %>% #Add gamma & beta
mutate(system_nr = 1000 + combination,
metaecosystem_type = "S_L_from_isolated",
disturbance = combinations_of_S_and_L[combination,]$disturbance)
}
SL_from_isolated = SL_from_isolated_single_rows %>%
bind_rows()
ds_metaecosystems = rbind(ds_metaecosystems,
SL_from_isolated)
### Add "Medium-Medium from isolated" to the metaecosystem dataset
culture_ID_of_isolated_M_low = ds_patches %>%
filter(eco_metaeco_type == "M",
disturbance == "low") %>%
pull(culture_ID) %>%
unique()
culture_ID_of_isolated_M_high = ds_patches %>%
filter(eco_metaeco_type == "M",
disturbance == "high") %>%
pull(culture_ID) %>%
unique()
combinations_M_and_M_low = combn(unique(culture_ID_of_isolated_M_low,
culture_ID_of_isolated_M_low),
m = 2) %>%
t() %>%
as.data.frame() %>%
mutate(disturbance = "low") %>%
rename(first_M_ID = V1,
second_M_ID = V2)
combinations_M_and_M_high = combn(unique(culture_ID_of_isolated_M_high,
culture_ID_of_isolated_M_high),
m = 2) %>%
t() %>%
as.data.frame() %>%
mutate(disturbance = "high") %>%
rename(first_M_ID = V1,
second_M_ID = V2)
combinations_of_M_and_M = rbind(combinations_M_and_M_low,
combinations_M_and_M_high)
number_of_combinations_of_M_and_M = nrow(combinations_of_M_and_M)
MM_from_isolated_single_rows = NULL
for (combination in 1:number_of_combinations_of_M_and_M){
MM_from_isolated_single_rows[[combination]] = ds_patches %>%
filter(culture_ID %in% combinations_of_M_and_M[combination,]) %>%
group_by(disturbance,
day,
time_point) %>%
summarise(total_metaecosystem_bioarea = sum(bioarea_tot),
total_metaecosystem_Ble = sum(Ble_tot),
total_metaecosystem_Cep = sum(Cep_tot),
total_metaecosystem_Col = sum(Col_tot),
total_metaecosystem_Eug = sum(Eug_tot),
total_metaecosystem_Eup = sum(Eup_tot),
total_metaecosystem_Lox = sum(Lox_tot),
total_metaecosystem_Pau = sum(Pau_tot),
total_metaecosystem_Pca = sum(Pca_tot),
total_metaecosystem_Spi = sum(Spi_tot),
total_metaecosystem_Spi_te = sum(Spi_te_tot),
total_metaecosystem_Tet = sum(Tet_tot)) %>% #Add gamma & beta
mutate(system_nr = 2000 + combination,
metaecosystem_type = "M_M_from_isolated")
}
MM_from_isolated = MM_from_isolated_single_rows %>%
bind_rows()
ds_metaecosystems = rbind(ds_metaecosystems,
MM_from_isolated)
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "M_M_from_isolated")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line ()
#Calculate beta diversity & gamma diversity
ds_metaecosystems = ds_metaecosystems %>%
mutate(jaccard_index = NA,
bray_curtis = NA,
metaecosystem_richness = NA)
for (system_nr_input in system_nr_metaecosystems) {
for (time_point_input in first_time_point:last_time_point) {
if (system_nr_input %in% metaecosystems_to_take_off)
next
species_density_of_the_two_patches = ds_patches %>%
filter(system_nr == system_nr_input,
time_point == time_point_input) %>%
ungroup() %>%
select(Ble:Tet)
#Beta diversity: Jaccard
jaccard_index = vegdist(species_density_of_the_two_patches,
method = "jaccard")
#Beta diversity: Bray Curtis
bray_curtis = vegdist(species_density_of_the_two_patches,
method = "bray")
#Gamma diversity: Meta-ecosystem richness
presence_absence_two_patches = ifelse(test = species_density_of_the_two_patches > 0,
yes = 1,
no = 0)
summed_columns = colSums(presence_absence_two_patches)
presence_absence_metaecosystem = ifelse(test = summed_columns > 0,
yes = 1,
no = 0)
metaecosystem_richness = sum(presence_absence_metaecosystem)
#Gamma diversity: Shannon
species_total_of_the_two_patches = ds_patches %>%
filter(system_nr == system_nr_input,
time_point == time_point_input) %>%
ungroup() %>%
select(Ble_tot:Tet_tot) %>%
map_dbl(function(x) if(is.numeric(x)) sum(x) else NA)
gamma_shannon = diversity(species_total_of_the_two_patches,
index = "shannon")
#Add to dataset
ds_metaecosystems$jaccard_index[
ds_metaecosystems$system_nr == system_nr_input &
ds_metaecosystems$time_point == time_point_input] =
jaccard_index
ds_metaecosystems$bray_curtis[
ds_metaecosystems$system_nr == system_nr_input &
ds_metaecosystems$time_point == time_point_input] =
bray_curtis
ds_metaecosystems$metaecosystem_richness[
ds_metaecosystems$system_nr == system_nr_input &
ds_metaecosystems$time_point == time_point_input] =
metaecosystem_richness
ds_metaecosystems$gamma_shannon[
ds_metaecosystems$system_nr == system_nr_input &
ds_metaecosystems$time_point == time_point_input] =
gamma_shannon
}
}
## Warning: Unknown or uninitialised column: `gamma_shannon`.
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"):
## missing values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): missing
## values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"):
## missing values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): missing
## values in results
## Warning in vegdist(species_density_of_the_two_patches, method = "jaccard"): you have empty rows: their dissimilarities may be
## meaningless in method "jaccard"
## Warning in vegdist(species_density_of_the_two_patches, method = "bray"): you have empty rows: their dissimilarities may be
## meaningless in method "bray"
#Add baselines (from t1)
baselines = ds_metaecosystems %>%
ungroup() %>%
filter(time_point == 1) %>%
select(system_nr,
total_metaecosystem_bioarea,
jaccard_index,
bray_curtis,
metaecosystem_richness,
gamma_shannon) %>%
rename(baseline_bioarea = total_metaecosystem_bioarea,
baseline_jaccard_index = jaccard_index,
baseline_bray_curtis = bray_curtis,
baseline_metaecosystem_richness = metaecosystem_richness,
baseline_gamma_shannon = gamma_shannon)
ds_metaecosystems = full_join(ds_metaecosystems, baselines)
saveRDS(ds_metaecosystems, file = here("results", "ds_metaecosystems.RData"))
datatable(ds_metaecosystems,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
load(here("data", "morphology", "t0.RData"));t0 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t1.RData"));t1 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t2.RData"));t2 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t3.RData"));t3 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t4.RData"));t4 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t5.RData"));t5 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t6.RData"));t6 = morph_mvt; rm(morph_mvt)
load(here("data", "morphology", "t7.RData"));t7 = morph_mvt; rm(morph_mvt)
t0$time = NA
t1$time = NA
t0$replicate_video[t0$file == "sample_00001"] = 1
t0$replicate_video[t0$file == "sample_00002"] = 2
t0$replicate_video[t0$file == "sample_00003"] = 3
t0$replicate_video[t0$file == "sample_00004"] = 4
t0$replicate_video[t0$file == "sample_00005"] = 5
t0$replicate_video[t0$file == "sample_00006"] = 6
t0$replicate_video[t0$file == "sample_00007"] = 7
t0$replicate_video[t0$file == "sample_00008"] = 8
t0$replicate_video[t0$file == "sample_00009"] = 9
t0$replicate_video[t0$file == "sample_00010"] = 10
t0$replicate_video[t0$file == "sample_00011"] = 11
t0$replicate_video[t0$file == "sample_00012"] = 12
t1$replicate_video = 1 #In t1 I took only 1 video/culture
t2$replicate_video = 1 #In t2 I took only 1 video/culture
t3$replicate_video = 1 #In t3 I took only 1 video/culture
t4$replicate_video = 1 #In t4 I took only 1 video/culture
t5$replicate_video = 1 #In t5 I took only 1 video/culture
t6 = t6 %>% rename(replicate_video = replicate)
t7 = t7 %>% rename(replicate_video = replicate)
cultures_n = max(culture_info$culture_ID)
original_t0_rows = nrow(t0)
ID_vector = rep(1:cultures_n, each = original_t0_rows)
t0 = t0 %>%
slice(rep(1:n(), cultures_n)) %>%
mutate(culture_ID = ID_vector)
t0 = merge(culture_info, t0, by="culture_ID")
t1 = merge(culture_info, t1, by="culture_ID")
t2 = merge(culture_info, t2, by="culture_ID")
t3 = merge(culture_info, t3, by="culture_ID")
t4 = merge(culture_info, t4, by="culture_ID")
t5 = merge(culture_info, t5, by="culture_ID")
t6 = merge(culture_info, t6, by="culture_ID")
t7 = merge(culture_info, t7, by="culture_ID")
ds_individuals = rbind(t0, t1, t2, t3, t4, t5, t6, t7)
rm(t0, t1, t2, t3, t4, t5, t6, t7)
ds_individuals$day = ds_individuals$time_point;
ds_individuals$day[ds_individuals$day=="t0"] = "0"
ds_individuals$day[ds_individuals$day=="t1"] = "4"
ds_individuals$day[ds_individuals$day=="t2"] = "8"
ds_individuals$day[ds_individuals$day=="t3"] = "12"
ds_individuals$day[ds_individuals$day=="t4"] = "16"
ds_individuals$day[ds_individuals$day=="t5"] = "20"
ds_individuals$day[ds_individuals$day=="t6"] = "24"
ds_individuals$day[ds_individuals$day=="t7"] = "28"
ds_individuals$day = as.numeric(ds_individuals$day)
ds_individuals$time_point[ds_individuals$time_point=="t0"] = 0
ds_individuals$time_point[ds_individuals$time_point=="t1"] = 1
ds_individuals$time_point[ds_individuals$time_point=="t2"] = 2
ds_individuals$time_point[ds_individuals$time_point=="t3"] = 3
ds_individuals$time_point[ds_individuals$time_point=="t4"] = 4
ds_individuals$time_point[ds_individuals$time_point=="t5"] = 5
ds_individuals$time_point[ds_individuals$time_point=="t6"] = 6
ds_individuals$time_point[ds_individuals$time_point=="t7"] = 7
ds_individuals$time_point = as.character(ds_individuals$time_point)
#Select useful columns
ds_individuals = ds_individuals %>%
select(culture_ID,
patch_size,
patch_size_volume,
disturbance,
metaecosystem_type,
mean_area,
replicate_video,
time_point,
day,
metaecosystem,
system_nr,
eco_metaeco_type)
saveRDS(ds_individuals, file = here("results", "ds_individuals.RData"))
I’m not showing the whole dataset because it’s too large.
datatable(head(ds_individuals),
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
I am here creating 12 size classes as in Jacquet, Gounand, and Altermatt (2020). However, for some reason it seems like our body size classes are really different.
nr_of_size_classes = 12
largest_size = max(ds_individuals$mean_area)
#largest_size = exp(11.4) To see what happens, let's set the largest size to the one of @Jacquet2020.
The logarithm of the largest individual in the experiment was 11.3795139 μm² compared to 11.4 in Jacquet, Gounand, and Altermatt (2020).
size_class_width = largest_size / nr_of_size_classes
size_class_boundaries = seq(from = 0,
to = largest_size,
by = size_class_width)
single_videos_rows = NULL
row = 0
for (class in 1:nr_of_size_classes) {
bin_lower_limit = size_class_boundaries[class]
bin_upper_limit = size_class_boundaries[class + 1]
mean_size = (size_class_boundaries[class] + size_class_boundaries[class + 1]) / 2
for (time_point_input in 0:last_time_point) {
for (culture_ID_input in 1:n_cultures) {
for (replicate_video_input in 1:nr_videos[time_point_input + 1]) {
row = row + 1
video_class_abundance = ds_individuals %>%
filter(
bin_lower_limit <= mean_area,
mean_area <= bin_upper_limit,
time_point == time_point_input,
culture_ID == culture_ID_input,
replicate_video == replicate_video_input
) %>%
summarise(size_class_abundance = n()) %>%
pull(size_class_abundance)
single_videos_rows[[row]] = ds_patches %>%
filter(
time_point == time_point_input,
culture_ID == culture_ID_input
) %>%
mutate(
replicate_video = replicate_video_input,
size_class_abundance = video_class_abundance,
size_class_n = class,
size_class = mean_size,
log_size_class = log(size_class),
log_abundance = log(size_class_abundance + 1)
)
}
}
}
}
#Watch out: it contains 27468 rows instead of 27720 because we excluded already culture_ID = 60, which I spilled during the experiment.
ds_classes = single_videos_rows %>%
bind_rows()
saveRDS(ds_classes, file = here("results", "ds_classes.RData"))
ds_classes = readRDS(here("results", "ds_classes.RData"))
datatable(ds_classes,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
ds_classes_effect_size = ds_classes %>%
group_by(
eco_metaeco_type,
metaecosystem,
patch_size,
disturbance,
day,
time_point,
size_class_n,
log_size_class
) %>%
summarise(
log_abundance_sd = sd(log_abundance),
abundance = mean(size_class_abundance),
abundance_sd = sd(size_class_abundance),
log_abundance = mean(log_abundance),
sample_size = n(),
) %>%
mutate(
log_abundance_se = log_abundance_sd / sqrt(sample_size),
log_abundance_lower_ci = log_abundance - qt(1 - (0.05 / 2), sample_size - 1) * log_abundance_se,
log_abundance_upper_ci = log_abundance + qt(1 - (0.05 / 2), sample_size - 1) * log_abundance_se
) %>%
mutate(abundance_hedges_d = NA,
abundance_hedges_d_upper = NA,
abundance_hedges_d_lower = NA)
#Expected number of rows: 12 size classes * 8 eco_metaeco_types * 2 disturbance types * 8 time points = 1536
treatments_and_controls = data.frame(
treatment = c("S (S_S)", "S (S_L)", "L (L_L)", "L (S_L)"),
control = c("S", "S", "L", "L")
)
n_of_treatments = nrow(treatments_and_controls)
row_n = 0
for (disturbance_input in c("low", "high")) {
for (treatment_n in 1:n_of_treatments) {
for (time_point_input in 0:7) {
for (size_class_input in 1:nr_of_size_classes) {
row_n = row_n + 1
eco_metaeco_treatment = treatments_and_controls$treatment[treatment_n]
treatment = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_treatment,
time_point == time_point_input,
size_class_n == size_class_input
)
eco_metaeco_control = treatments_and_controls$control[treatment_n]
control = ds_classes_effect_size %>%
filter(
disturbance == disturbance_input,
eco_metaeco_type == eco_metaeco_control,
time_point == time_point_input,
size_class_n == size_class_input
)
#Body size class abundance
hedges_d_size_class = calculate.hedges_d(
treatment$abundance,
treatment$abundance_sd,
treatment$sample_size,
control$abundance,
control$abundance_sd,
control$sample_size
)
ds_classes_effect_size$abundance_hedges_d[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$d
ds_classes_effect_size$abundance_hedges_d_upper[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$upper_CI
ds_classes_effect_size$abundance_hedges_d_lower[
ds_classes_effect_size$disturbance == disturbance_input &
ds_classes_effect_size$eco_metaeco_type == eco_metaeco_treatment &
ds_classes_effect_size$time_point == time_point_input &
ds_classes_effect_size$size_class_n == size_class_input] =
hedges_d_size_class$lower_CI
}
}
}
}
saveRDS(ds_classes_effect_size, file = here("results", "ds_classes_effect_size.RData"))
datatable(ds_classes_effect_size,
rownames = FALSE,
options = list(scrollX = TRUE),
filter = list(position = 'top',
clear = FALSE))
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type, total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = '') +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small-Small",
"Medium-Medium",
"Large-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type,
total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Beta diversity (Bray-Curtis Index)",
color = '',
fill = '',
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small-Small",
"Medium-Medium",
"Large-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
## Warning: Removed 2 rows containing non-finite values (stat_boxplot).
p_boxplots = ds_metaecosystems %>%
mutate(metaecosystem_type = fct_reorder(metaecosystem_type, total_metaecosystem_bioarea)) %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_S", "M_M", "L_L")) %>%
ggplot (aes(
x = day,
y = gamma_shannon,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Gamma diversity (Shannon Index)",
color = '',
fill = '',
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small-Small",
"Medium-Medium",
"Large-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
fill = "System nr",
color = "System nr",
linetype = ""
) +
scale_linetype_discrete(labels = c("Medium-Medium",
"Small-Large")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots
filtered_data = ds_metaecosystems %>%
filter(metaecosystem_type %in% c("M_M", "S_L"),
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lmer(
total_metaecosystem_bioarea ~
day +
metaecosystem_type +
metaecosystem_type : day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
plot(full_model)
qqnorm(resid(full_model))
null_model = lmer(
total_metaecosystem_bioarea ~
day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
AIC = AIC(full_model, null_model) #When I add baseline_bioarea : day, the AIC of the model stays the same when I take off the ecosystem type.
AIC
## df AIC
## full_model 8 2246.608
## null_model 6 2245.270
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Data: filtered_data
## Models:
## null_model: total_metaecosystem_bioarea ~ day + (day | system_nr)
## full_model: total_metaecosystem_bioarea ~ day + metaecosystem_type + metaecosystem_type:day + (day | system_nr)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 6 2245.3 2257.8 -1116.6 2233.3
## full_model 8 2246.6 2263.4 -1115.3 2230.6 2.6625 2 0.2641
p_value = anova$`Pr(>Chisq)`[2]
p_value = round(p_value, digits = 3)
p_boxplots +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value))
Let’s start by looking at whether meta-ecosystem type and disturbance had an effect at time point = 1. At this time point, no disturbance event had yet occurred. Therefore, we would not expect an effect of disturbance. In regards to meta-ecosystem type, there might be an effect if it comes from just the sizes of the two ecosystems.
chosen_time_point = 1
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_1 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_1
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 381.3874
## null_model 2 379.3883
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.1760e+16
## 2 9 1.1761e+16 -1 -1.024e+12 7e-04 0.9796
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_1 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 2
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_2 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_2
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 390.0781
## null_model 2 390.2016
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 2.8043e+16
## 2 9 3.4677e+16 -1 -6.6345e+15 1.8927 0.2062
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_2 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 3
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_3 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_3
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 379.3636
## null_model 2 378.9266
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 9.6051e+15
## 2 9 1.1230e+16 -1 -1.625e+15 1.3534 0.2782
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_3 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 4
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_4 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_4
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 371.4657
## null_model 2 369.4752
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 4.3601e+15
## 2 9 4.3643e+15 -1 -4.1419e+12 0.0076 0.9327
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_4 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 5
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_5 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_5
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 372.8344
## null_model 2 371.0369
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 4.9997e+15
## 2 9 5.1019e+15 -1 -1.0227e+14 0.1636 0.6964
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_5 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 6
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_6 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_6
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 362.4574
## null_model 2 360.5318
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.7712e+15
## 2 9 1.7845e+15 -1 -1.3233e+13 0.0598 0.813
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_6 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
chosen_time_point = 7
filtered_data = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"),
time_point == chosen_time_point)
day_of_time_point = unique(filtered_data$day)
time_point_7 = filtered_data %>%
ggplot (aes(x = metaecosystem_type,
y = total_metaecosystem_bioarea)) +
geom_boxplot() +
labs(
title = paste0(
"Time point = ",
chosen_time_point
),
x = "",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
)
time_point_7
full_model = lm(total_metaecosystem_bioarea ~
metaecosystem_type,
data = filtered_data)
par(mfrow=c(2,3))
plot(full_model, which = 1:5)
null_model = lm(total_metaecosystem_bioarea ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 3 353.8103
## null_model 2 352.2821
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: total_metaecosystem_bioarea ~ metaecosystem_type
## Model 2: total_metaecosystem_bioarea ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 7.4599e+14
## 2 9 7.8203e+14 -1 -3.6037e+13 0.3865 0.5515
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
time_point_7 +
labs(
title = paste0(
"Day = ",
day_of_time_point,
", ΔAIC = ",
deltaAIC ,
", p = ",
p_value,
", Adjusted R2 = ",
R2_P
)
)
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (
aes(
x = day,
y = bray_curtis,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
title = paste("Disturbance =", disturbance_input),
x = "Day",
y = "Beta Diversity (Bray-Curtis Index)",
fill = "System nr",
color = "System nr",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
scale_linetype_discrete(labels = c("Medium-Medium",
"Small-Large")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_boxplots = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (aes(
x = day,
y = bray_curtis,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Beta diversity (Bray-Curtis Index)",
color = '',
fill = '',
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
filtered_data = ds_metaecosystems %>%
filter(time_point >= 2,
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"))
full_model = lmer(
bray_curtis ~
day +
metaecosystem_type +
metaecosystem_type : day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
summary(full_model)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: bray_curtis ~ day + metaecosystem_type + metaecosystem_type:day +
## (day | system_nr)
## Data: filtered_data
## Control: lmerControl(optimizer = "Nelder_Mead")
##
## AIC BIC logLik deviance df.resid
## -68.7 -52.0 42.4 -84.7 52
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.09505 -0.63710 -0.00973 0.51845 1.89030
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## system_nr (Intercept) 3.855e-03 0.0620883
## day 1.965e-07 0.0004433 1.00
## Residual 1.155e-02 0.1074611
## Number of obs: 60, groups: system_nr, 10
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.345643 0.061874 5.586
## day 0.004315 0.002879 1.499
## metaecosystem_typeS_L 0.047438 0.087504 0.542
## day:metaecosystem_typeS_L 0.013498 0.004071 3.315
##
## Correlation of Fixed Effects:
## (Intr) day mt_S_L
## day -0.803
## mtcsyst_S_L -0.707 0.568
## dy:mtcs_S_L 0.568 -0.707 -0.803
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
plot(full_model)
qqnorm(resid(full_model))
null_model = lmer(
bray_curtis ~
day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 8 -68.71713
## null_model 6 -56.37168
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Data: filtered_data
## Models:
## null_model: bray_curtis ~ day + (day | system_nr)
## full_model: bray_curtis ~ day + metaecosystem_type + metaecosystem_type:day + (day | system_nr)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 6 -56.372 -43.806 34.186 -68.372
## full_model 8 -68.717 -51.962 42.359 -84.717 16.346 2 0.0002822 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>Chisq)`[2]
p_value = round(p_value, digits = 3)
MM_SL_beta_diversity = p_boxplots +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value))
MM_SL_beta_diversity
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (
aes(
x = day,
y = gamma_shannon,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
title = paste("Disturbance =", disturbance_input),
x = "Day",
y = "Beta Diversity (Bray-Curtis Index)",
fill = "System nr",
color = "System nr",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
scale_linetype_discrete(labels = c("Medium-Medium",
"Small-Large")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_boxplots = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "M_M")) %>%
ggplot (aes(
x = day,
y = gamma_shannon,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Gamma diversity (Shannon Index)",
color = '',
fill = '',
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium",
"Small-Large")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
filtered_data = ds_metaecosystems %>%
filter(time_point >= 2,
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L"))
full_model = lmer(
gamma_shannon ~
day +
metaecosystem_type +
metaecosystem_type : day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
summary(full_model)
## Linear mixed model fit by maximum likelihood ['lmerMod']
## Formula: gamma_shannon ~ day + metaecosystem_type + metaecosystem_type:day +
## (day | system_nr)
## Data: filtered_data
## Control: lmerControl(optimizer = "Nelder_Mead")
##
## AIC BIC logLik deviance df.resid
## 18.8 35.5 -1.4 2.8 52
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -3.8994 -0.6512 0.1666 0.5901 1.7609
##
## Random effects:
## Groups Name Variance Std.Dev. Corr
## system_nr (Intercept) 1.266e-02 0.112500
## day 8.781e-05 0.009371 -1.00
## Residual 5.570e-02 0.236015
## Number of obs: 60, groups: system_nr, 10
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 1.638168 0.131451 12.462
## day -0.002805 0.007573 -0.370
## metaecosystem_typeS_L -0.047316 0.185900 -0.255
## day:metaecosystem_typeS_L -0.004110 0.010710 -0.384
##
## Correlation of Fixed Effects:
## (Intr) day mt_S_L
## day -0.931
## mtcsyst_S_L -0.707 0.658
## dy:mtcs_S_L 0.658 -0.707 -0.931
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
plot(full_model)
qqnorm(resid(full_model))
null_model = lmer(
gamma_shannon ~
day +
(day | system_nr),
data = filtered_data,
REML = FALSE,
control = lmerControl(optimizer = "Nelder_Mead")
)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 8 18.78281
## null_model 6 17.46782
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Data: filtered_data
## Models:
## null_model: gamma_shannon ~ day + (day | system_nr)
## full_model: gamma_shannon ~ day + metaecosystem_type + metaecosystem_type:day + (day | system_nr)
## npar AIC BIC logLik deviance Chisq Df Pr(>Chisq)
## null_model 6 17.468 30.034 -2.7339 5.4678
## full_model 8 18.783 35.538 -1.3914 2.7828 2.685 2 0.2612
p_value = anova$`Pr(>Chisq)`[2]
p_value = round(p_value, digits = 3)
MM_SL_gamma_diversity = p_boxplots +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value))
MM_SL_gamma_diversity
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Ble,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Ble Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Cep,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Cep Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Col Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eug,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eug Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eup,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eup Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Lox,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Lox Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Pau,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pau Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pca Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi_te,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi te Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "S_L")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Tet,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Tet Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
"Medium-Medium",
"Small-Large"
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
Do a meta-ecosystem with patches of the same size and a meta-ecosystems with patches of different size have different metaecosystem biomass density because of their resource flow? Or would we see this also with small and large ecosystems that are not connected? (Do the small-large meta-ecosystems have different biomass density from two isolated small and large patches?)
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "M_M_from_isolated")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
fill = "System nr",
color = "System nr",
linetype = ""
) +
scale_linetype_discrete(labels = c("Medium-Medium",
"Medium-Medium from isolated")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots = ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M", "M_M_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(x = "Day",
y = "Regional bioarea (µm²)",
fill = "",
caption = "Vertical grey line: first perturbation") +
scale_fill_manual(values = c(colour_SL, colour_isolated),
labels = c("Medium-Medium", "Medium-Medium from isolated")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = first_perturbation_day + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_boxplots
##Bootstrap from all combinations the p value and delta AIC
system_nr_MM_from_isolated = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "M_M_from_isolated") %>%
pull(system_nr) %>%
unique()
n_of_MM_metaecos = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "M_M") %>%
pull(system_nr) %>%
unique() %>%
length()
possible_combinations = combn(system_nr_MM_from_isolated,
m = n_of_MM_metaecos) %>%
t()
n_subsamples = nrow(possible_combinations)
subsetted_combinations = possible_combinations #There are only 252 possible combinations
statistics = NULL
for (combination_nr in 1:n_subsamples){
combination = subsetted_combinations[combination_nr,]
filtered_ds = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "M_M" | system_nr %in% combination,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
# filtered_ds %>%
# ggplot(
# aes(
# x = day,
# y = total_metaecosystem_bioarea,
# group = interaction(day, metaecosystem_type),
# fill = metaecosystem_type
# )
# ) +
# geom_boxplot()
full_model = lmer(
total_metaecosystem_bioarea ~
day +
metaecosystem_type +
day:metaecosystem_type +
(day | system_nr),
data = filtered_ds,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead")
)
null_model = lmer(
total_metaecosystem_bioarea ~
day +
(day | system_nr),
data = filtered_ds,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead")
)
anova = anova(full_model, null_model)
p_value = anova$`Pr(>Chisq)`[2]
AIC_full_model = tidy(anova) %>%
filter(term == "full_model") %>%
pull(AIC)
AIC_null_model = tidy(anova) %>%
filter(term == "null_model") %>%
pull(AIC)
delta_AIC = AIC_full_model - AIC_null_model
statistics[[combination_nr]] = data.frame(p_value = p_value,
delta_AIC = delta_AIC)
print(paste0(combination_nr, "/", n_subsamples, " done"))
}
statistics = statistics %>%
bind_rows()
write.csv(statistics, here("results", "statistics_MM_from_isolated.csv"))
statistics = read.csv(here("results", "statistics_MM_from_isolated.csv"))
confidence_interval = 95
percentage_subsamples_to_take_off = 100 - confidence_interval
ratio_subsamples_to_take_off = percentage_subsamples_to_take_off / 100
n_subsamples_to_take_off = n_subsamples * ratio_subsamples_to_take_off
upper_bound = n_subsamples - (n_subsamples_to_take_off / 2) %>%
ceiling()
lower_bound = 1 + (n_subsamples_to_take_off / 2) %>%
floor()
p_values = statistics$p_value %>%
sort(decreasing = TRUE)
delta_AIC_values = statistics$delta_AIC %>%
sort(decreasing = TRUE)
bootstrapped_statistics = data.frame(
p_values_mean = mean(p_values),
p_values_upper_CI = p_values[upper_bound],
p_values_lower_CI = p_values[lower_bound],
delta_AIC_mean = mean(delta_AIC_values),
delta_AIC_upper_CI = delta_AIC_values[upper_bound],
delta_AIC_lower_CI = delta_AIC_values[lower_bound]
)
bootstrapped_statistics
## p_values_mean p_values_upper_CI p_values_lower_CI delta_AIC_mean
## 1 0.005819094 0.001479792 0.01154123 -6.538252
## delta_AIC_upper_CI delta_AIC_lower_CI
## 1 -9.031707 -4.923659
p_value = round(bootstrapped_statistics$p_values_mean, digits = 3)
delta_AIC = round(bootstrapped_statistics$delta_AIC_mean, digits = 2)
p_boxplots +
labs(title = paste0("p = ", p_value, ", ΔAIC = ", delta_AIC))
Do a meta-ecosystem with patches of the same size and a meta-ecosystems with patches of different size have different metaecosystem biomass density because of their resource flow? Or would we see this also with small and large ecosystems that are not connected? (Do the small-large meta-ecosystems have different biomass density from two isolated small and large patches?)
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
fill = "System nr",
color = "System nr",
linetype = ""
) +
scale_linetype_discrete(labels = c("Small-Large",
"Small-Large from isolated")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots = ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Regional bioarea (µm²)",
fill = "",
caption = "Vertical grey line: resouce flow"
) +
scale_fill_manual(values = c(colour_SL, colour_isolated),
labels = c("Small-Large", "Small-Large from isolated")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_boxplots
##Bootstrap from all combinations the p value and delta AIC
system_nr_SL_from_isolated = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "S_L_from_isolated") %>%
pull(system_nr) %>%
unique()
n_of_SL_metaecos = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "S_L") %>%
pull(system_nr) %>%
unique() %>%
length()
possible_combinations = combn(x = system_nr_SL_from_isolated,
m = n_of_SL_metaecos) %>%
t()
n_combinations = nrow(possible_combinations)
n_subsamples = 2000
random_subset_of_combinations = sample(1:n_combinations,
n_subsamples,
replace = FALSE)
subsetted_combinations = possible_combinations[random_subset_of_combinations,]
statistics = NULL
for (combination_nr in 1:n_subsamples){
combination = subsetted_combinations[combination_nr,]
filtered_ds = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type == "S_L" | system_nr %in% combination,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
# filtered_ds %>%
# ggplot(
# aes(
# x = day,
# y = total_metaecosystem_bioarea,
# group = interaction(day, metaecosystem_type),
# fill = metaecosystem_type
# )
# ) +
# geom_boxplot()
full_model = lmer(
total_metaecosystem_bioarea ~
day +
metaecosystem_type +
day:metaecosystem_type +
(day | system_nr),
data = filtered_ds,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead")
)
null_model = lmer(
total_metaecosystem_bioarea ~
day +
(day | system_nr),
data = filtered_ds,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead")
)
anova = anova(full_model, null_model)
p_value = anova$`Pr(>Chisq)`[2]
AIC_full_model = tidy(anova) %>%
filter(term == "full_model") %>%
pull(AIC)
AIC_null_model = tidy(anova) %>%
filter(term == "null_model") %>%
pull(AIC)
delta_AIC = AIC_full_model - AIC_null_model
statistics[[combination_nr]] = data.frame(p_value = p_value,
delta_AIC = delta_AIC)
print(paste0(combination_nr, "/", n_subsamples, " done"))
}
statistics = statistics %>%
bind_rows()
write.csv(statistics, here("results", "statistics_SL_from_isolated.csv"))
statistics = read.csv(here("results", "statistics_SL_from_isolated.csv"))
confidence_interval = 95
percentage_subsamples_to_take_off = 100 - confidence_interval
ratio_subsamples_to_take_off = percentage_subsamples_to_take_off / 100
n_subsamples_to_take_off = n_subsamples * ratio_subsamples_to_take_off
upper_bound = n_subsamples - (n_subsamples_to_take_off / 2) %>%
ceiling()
lower_bound = 1 + (n_subsamples_to_take_off / 2) %>%
floor()
p_values = statistics$p_value %>%
sort(decreasing = TRUE)
delta_AIC_values = statistics$delta_AIC %>%
sort(decreasing = TRUE)
bootstrapped_statistics = data.frame(
p_values_mean = mean(p_values),
p_values_upper_CI = p_values[upper_bound],
p_values_lower_CI = p_values[lower_bound],
delta_AIC_mean = mean(delta_AIC_values),
delta_AIC_upper_CI = delta_AIC_values[upper_bound],
delta_AIC_lower_CI = delta_AIC_values[lower_bound]
)
p_value = round(bootstrapped_statistics$p_values_mean, digits = 3)
delta_AIC = round(bootstrapped_statistics$delta_AIC_mean, digits = 2)
p_boxplots +
labs(title = paste0("p = ", p_value, ", ΔAIC = ", delta_AIC))
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Ble,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Ble Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Cep,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Cep Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Col Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eug,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eug Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eup,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eup Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Lox,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Lox Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Pau,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pau Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pca Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi_te,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi te Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("S_L", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Tet,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Tet Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_SL, colour_isolated),
labels = c(
name_SL,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter (disturbance == disturbance_input,
metaecosystem_type %in% c("S_L_from_isolated", "M_M_from_isolated")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = system_nr,
fill = system_nr,
color = system_nr,
linetype = metaecosystem_type
)
) +
geom_line () +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
fill = "System nr",
color = "System nr",
linetype = ""
) +
scale_linetype_discrete(labels = c("Medium-Medium from isolated",
"Small-Large from isolated")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
#scale_y_continuous(labels = comma) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots = ds_metaecosystems %>%
filter(disturbance == disturbance_input,
metaecosystem_type %in% c("S_L_from_isolated", "M_M_from_isolated")) %>%
ggplot (
aes(
x = day,
y = total_metaecosystem_bioarea,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Meta-ecosystem Total Bioarea (µm²)",
color = '',
fill = ''
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c("Medium-Medium from isolated",
"Small-Large from isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(caption = "Vertical grey line: resource flow")
p_boxplots
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Ble,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Ble Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Cep,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Cep Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Col Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eug,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eug Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Eup,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eup Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Lox,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Lox Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Pau,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pau Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Col,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pca Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Spi_te,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi te Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_metaecosystems %>%
filter(
disturbance == disturbance_input,
metaecosystem_type %in% c("M_M_from_isolated", "S_L_from_isolated")
) %>%
ggplot(
aes(
x = day,
y = total_metaecosystem_Tet,
group = interaction(day, metaecosystem_type),
fill = metaecosystem_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Tet Total Individuals",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_MM, colour_SL),
labels = c(
name_MM_from_isolated,
name_SL_from_isolated
)
) +
scale_x_continuous(breaks = unique(ds_metaecosystems$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Ble,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Ble Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Cep,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Cep Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Col,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Col Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Eug,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Eug Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Eup,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Eup Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Lox,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Lox Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Pau,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Pau Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Pca,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Pca Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Spi,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Spi Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Spi_te,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Spi_te Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
metaecosystem == "no") %>%
mutate(eco_metaeco_type = fct_reorder(eco_metaeco_type, patch_size_volume)) %>%
ggplot(aes(
x = day,
y = Tet,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Tet Density (indiv/μl ?)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
scale_fill_manual(
values = c(colour_small, colour_medium, colour_large),
labels = c("Small isolated",
"Medium isolated",
"Large isolated")
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(
labels = c(
"Small isolated",
"Small connected to small",
"Small connected to large"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "S",
disturbance == disturbance_input) %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)")
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Small connected to large",
"Small connnected to small")) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)","S (S_L)"))
full_model = lm(bioarea_per_volume_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(bioarea_per_volume_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 20.34559
## null_model 2 22.91411
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: bioarea_per_volume_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 1.6639
## 2 11 3.3981 -3 -1.7342 2.7793 0.1101
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
scale_linetype_discrete(labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "S") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)")
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Small connected to large",
"Small connnected to small")) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("S (S_S)", "S (S_L)"))
full_model = lm(shannon_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(shannon_d ~
1,
data = filtered_data)
anova = anova(full_model, null_model)
AIC = AIC(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: shannon_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: shannon_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.6959
## 2 11 6.4818 -3 -2.7859 2.0101 0.1912
AIC
## df AIC
## full_model 5 29.92228
## null_model 2 30.66365
p_value = anova$`Pr(>F)`[2]
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
p_value = round(p_value, digits = 2)
R2_full = round(R2_full, digits = 2)
R2_P = round(R2_P, digits = 2)
deltaAIC = round(deltaAIC, digits = 2)
final_figure = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC, ", p = ", p_value, ", R2 (pach type) = ", R2_P))
final_figure
final_figure +
theme_bw(base_size = presentation_size) +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "none"
) +
labs(caption = "")
ggsave(here("results", "presentations", "small_alpha.png"))
patch_size_input = "S"
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Ble,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Ble Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Ble_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Ble_d_lower,
ymax = Ble_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Ble Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Ble_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Ble_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.38157 -0.12077 -0.02903 0.17685 0.36931
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.05831 0.32876 0.177 0.865
## eco_metaeco_typeS (S_S) 0.02576 0.46494 0.055 0.958
## eco_metaeco_typeS (S_L):day 0.02004 0.01721 1.164 0.289
## eco_metaeco_typeS (S_S):day 0.01615 0.01721 0.938 0.384
##
## Residual standard error: 0.2855 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.2764, Adjusted R-squared: -0.08545
## F-statistic: 0.7638 on 3 and 6 DF, p-value: 0.5544
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Ble_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 8.203533
## null_model 2 5.438243
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Ble_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Ble_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 0.48922
## 2 9 0.67606 -3 -0.18684 0.7638 0.5544
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Ble_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Ble_small
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Cep,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Cep Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Cep_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Cep_d_lower,
ymax = Cep_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Cep Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Cep_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Cep_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.68801 -0.33337 -0.05486 0.17948 1.36224
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.10845 0.73251 0.148 0.886
## eco_metaeco_typeS (S_S) -0.04713 1.03593 -0.045 0.965
## eco_metaeco_typeS (S_L):day 0.02537 0.03805 0.667 0.524
## eco_metaeco_typeS (S_S):day 0.02238 0.03805 0.588 0.573
##
## Residual standard error: 0.6367 on 8 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.0977, Adjusted R-squared: -0.2407
## F-statistic: 0.2888 on 3 and 8 DF, p-value: 0.8324
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Cep_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 28.35221
## null_model 2 23.58595
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Cep_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Cep_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.2426
## 2 11 3.5937 -3 -0.35112 0.2888 0.8324
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Cep_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Cep_small
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Col,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Col Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Col_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Col_d_lower,
ymax = Col_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Col Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Col_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Col_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 8 9 12 13 14 15 18
## 0.38322 -0.51594 0.04923 0.08350 -0.34259 0.21704 0.28160 -0.15605
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.25309 0.49038 0.516 0.633
## eco_metaeco_typeS (S_S) -0.95201 0.69349 -1.373 0.242
## eco_metaeco_typeS (S_L):day 0.00676 0.02776 0.244 0.820
## eco_metaeco_typeS (S_S):day 0.04274 0.02776 1.540 0.198
##
## Residual standard error: 0.4155 on 4 degrees of freedom
## (10 observations deleted due to missingness)
## Multiple R-squared: 0.5043, Adjusted R-squared: 0.1326
## F-statistic: 1.357 on 3 and 4 DF, p-value: 0.3755
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Col_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 13.10562
## null_model 2 12.72051
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Col_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Col_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 4 0.69057
## 2 7 1.39324 -3 -0.70266 1.3567 0.3755
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Col_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Col_small
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eug,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eug Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eug_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eug_d_lower,
ymax = Eug_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eug Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 18 rows containing missing values (geom_point).
## Warning: Removed 18 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eug_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eug_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eug_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eug_small
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Eup,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Eup Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Eup_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Eup_d_lower,
ymax = Eup_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Eup Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Eup_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Eup_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.03376 -0.65207 -0.07713 0.72668 1.08670
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.18379 1.14994 1.029 0.343
## eco_metaeco_typeS (S_S) -1.36371 1.62626 -0.839 0.434
## eco_metaeco_typeS (S_L):day -0.04992 0.06021 -0.829 0.439
## eco_metaeco_typeS (S_S):day -0.00592 0.06021 -0.098 0.925
##
## Residual standard error: 0.9988 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.2071, Adjusted R-squared: -0.1893
## F-statistic: 0.5225 on 3 and 6 DF, p-value: 0.6825
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Eup_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 33.24617
## null_model 2 29.56726
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Eup_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Eup_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 5.9854
## 2 9 7.5491 -3 -1.5637 0.5225 0.6825
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Eup_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Eup_small
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Lox,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Lox Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Lox_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Lox_d_lower,
ymax = Lox_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Lox Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 15 rows containing missing values (geom_point).
## Warning: Removed 14 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Lox_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Lox_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 13 14 16
## 1.041e-17 -7.023e-02 1.053e-01 -3.511e-02
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.23548 0.13138 1.792 0.324
## eco_metaeco_typeS (S_S) -0.20965 0.25320 -0.828 0.560
## eco_metaeco_typeS (S_L):day NA NA NA NA
## eco_metaeco_typeS (S_S):day 0.01756 0.01520 1.155 0.454
##
## Residual standard error: 0.1314 on 1 degrees of freedom
## (14 observations deleted due to missingness)
## Multiple R-squared: 0.5761, Adjusted R-squared: -0.2716
## F-statistic: 0.6796 on 2 and 1 DF, p-value: 0.651
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
## Warning: not plotting observations with leverage one:
## 1
null_model = lm(Lox_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 4 -2.430878
## null_model 2 -2.997459
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Lox_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Lox_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 1 0.017261
## 2 3 0.040724 -2 -0.023463 0.6796 0.651
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Lox_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Lox_small
## Warning: Removed 15 rows containing missing values (geom_point).
## Warning: Removed 14 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pau,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pau Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pau_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pau_d_lower,
ymax = Pau_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pau Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 9 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pau_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pau_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.45184 -0.12754 0.02808 0.06558 0.76843
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.74313 0.46823 3.723 0.00982 **
## eco_metaeco_typeS (S_S) -0.60956 0.81633 -0.747 0.48346
## eco_metaeco_typeS (S_L):day -0.02696 0.02432 -1.109 0.31000
## eco_metaeco_typeS (S_S):day -0.01652 0.04550 -0.363 0.72900
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.407 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.3473, Adjusted R-squared: 0.02091
## F-statistic: 1.064 on 3 and 6 DF, p-value: 0.4315
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pau_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 15.28944
## null_model 2 13.55546
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pau_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pau_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 0.99367
## 2 9 1.52235 -3 -0.52868 1.0641 0.4315
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pau_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pau_small
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 9 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Pca,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Pca Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Pca_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Pca_d_lower,
ymax = Pca_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Pca Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Pca_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Pca_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.5505 -0.3857 0.1251 0.3293 0.5112
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.33118 0.64470 -0.514 0.626
## eco_metaeco_typeS (S_S) -0.08442 0.85851 -0.098 0.925
## eco_metaeco_typeS (S_L):day 0.06766 0.03799 1.781 0.125
## eco_metaeco_typeS (S_S):day 0.03714 0.03123 1.189 0.279
##
## Residual standard error: 0.4805 on 6 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.5646, Adjusted R-squared: 0.3468
## F-statistic: 2.593 on 3 and 6 DF, p-value: 0.1479
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Pca_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 18.61320
## null_model 2 20.92713
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Pca_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Pca_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 6 1.3855
## 2 9 3.1817 -3 -1.7963 2.593 0.1479
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Pca_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Pca_small
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_d_lower,
ymax = Spi_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.7432 -0.2107 0.1012 0.2639 0.3685
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.39344 0.46008 0.855 0.4208
## eco_metaeco_typeS (S_S) -1.62592 0.70675 -2.301 0.0549 .
## eco_metaeco_typeS (S_L):day 0.01342 0.02390 0.562 0.5919
## eco_metaeco_typeS (S_S):day 0.09592 0.03161 3.034 0.0190 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3999 on 7 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.6198, Adjusted R-squared: 0.4569
## F-statistic: 3.804 on 3 and 7 DF, p-value: 0.06614
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 16.07936
## null_model 2 20.71687
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 7 1.1193
## 2 10 2.9439 -3 -1.8246 3.8037 0.06614 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_small
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Spi_te,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Spi_te Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Spi_te_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Spi_te_d_lower,
ymax = Spi_te_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Spi_te Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 13 rows containing missing values (geom_point).
## Warning: Removed 11 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Spi_te_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## 7 8 9 13 15 17
## 0.09391 -0.18783 0.09391 -0.07361 0.14721 -0.07361
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.558931 0.454367 3.431 0.0755 .
## eco_metaeco_typeS (S_S) -1.293183 0.553276 -2.337 0.1444
## eco_metaeco_typeS (S_L):day -0.070436 0.036535 -1.928 0.1937
## eco_metaeco_typeS (S_S):day 0.006238 0.018267 0.341 0.7653
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2067 on 2 degrees of freedom
## (12 observations deleted due to missingness)
## Multiple R-squared: 0.8018, Adjusted R-squared: 0.5045
## F-statistic: 2.697 on 3 and 2 DF, p-value: 0.2821
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Spi_te_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 1.516159
## null_model 2 5.226580
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: Spi_te_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: Spi_te_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 2 0.08543
## 2 5 0.43098 -3 -0.34556 2.6967 0.2821
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Spi_te_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Spi_te_small
## Warning: Removed 13 rows containing missing values (geom_point).
## Warning: Removed 11 row(s) containing missing values (geom_path).
ds_patches %>%
filter(
disturbance == disturbance_input,
patch_size == patch_size_input
) %>%
ggplot(
aes(
x = day,
y = Tet,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Tet Density (indiv/ml)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Small isolated",
"Small connected to large",
"Small connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(disturbance == disturbance_input,
patch_size == patch_size_input,
day > 0) %>%
ggplot(aes(
x = day,
y = Tet_d,
color = eco_metaeco_type
)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = Tet_d_lower,
ymax = Tet_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Tet Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(
labels = c("Small connected to large",
"Small connnected to small")
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
## Warning: Removed 20 rows containing missing values (geom_point).
## Warning: Removed 20 row(s) containing missing values (geom_path).
filtered_data = ds_patches_effect_size %>%
filter(patch_size == patch_size_input,
disturbance == disturbance_input,
time_point >= first_time_point_model,
time_point <= last_time_point_model)
full_model = lm(Tet_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(Tet_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
density_Tet_small = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
density_Tet_small
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(
labels = c(
"Medium isolated",
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "M",
disturbance == disturbance_input) %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)
) +
geom_boxplot() +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size, colour_same_size),
labels = c(
"Medium isolated",
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "M (M_M)"
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = "Medium connected to medium") +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
scale_linetype_discrete(labels = c(
"Medium isolated",
"Medium connected to medium"
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "M") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
labs(
x = "Day",
y = "Alpha Diversity (Shannon Index)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_different_size),
labels = c(
"Medium isolated",
"Medium connected to medium"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "M (M_M)"
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Medium connected to medium")) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(
aes(
x = day,
y = bioarea_per_volume,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(labels = c(
"Large isolated",
"Large connected to large",
"Large connected to small"
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(patch_size == "L",
disturbance == disturbance_input) %>%
ggplot(aes(
x = day,
y = bioarea_per_volume,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
labs(
x = "Day",
y = "Patch Bioarea (µm²/μl)",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_same_size, colour_different_size),
labels = c(
"Large isolated",
"Large connected to large",
"Large connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)")
) %>%
ggplot(aes(x = day,
y = bioarea_per_volume_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = bioarea_per_volume_d_lower,
ymax = bioarea_per_volume_d_upper),
width = .2,
position = position_dodge(0.5)
) +
labs(
x = "Day",
y = "Bioarea Density Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Large connected to large",
"Large connnected to small")) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)"))
full_model = lm(bioarea_per_volume_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -1.21472 0.02444 0.11600 0.31913 0.57026
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.186323 0.773379 -0.241 0.816
## eco_metaeco_typeL (S_L) -0.691710 1.093723 -0.632 0.545
## eco_metaeco_typeL (L_L):day -0.009806 0.040170 -0.244 0.813
## eco_metaeco_typeL (S_L):day -0.013221 0.040170 -0.329 0.751
##
## Residual standard error: 0.6722 on 8 degrees of freedom
## Multiple R-squared: 0.3297, Adjusted R-squared: 0.0783
## F-statistic: 1.312 on 3 and 8 DF, p-value: 0.3362
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(bioarea_per_volume_d ~
1,
data = filtered_data)
AIC = AIC(full_model, null_model)
AIC
## df AIC
## full_model 5 29.65512
## null_model 2 28.45505
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
deltaAIC = round(deltaAIC, digits = 2)
anova = anova(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: bioarea_per_volume_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: bioarea_per_volume_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 3.6145
## 2 11 5.3922 -3 -1.7777 1.3115 0.3362
p_value = anova$`Pr(>F)`[2]
p_value = round(p_value, digits = 3)
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
R2_P = round(R2_P, digits = 2)
large_biomass = p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC , ", p = ", p_value, ", Adjusted R2 = ", R2_P))
large_biomass
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(
aes(
x = day,
y = shannon,
group = culture_ID,
fill = culture_ID,
color = culture_ID,
linetype = eco_metaeco_type
)
) +
geom_line(stat = "summary", fun = "mean") +
labs(
x = "Day",
y = "Shannon Index",
linetype = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_linetype_discrete(labels = c(
"Large isolated",
"Large connected to large",
"Large connected to small"
)) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
ds_patches %>%
filter(disturbance == disturbance_input,
patch_size == "L") %>%
ggplot(aes(
x = day,
y = shannon,
group = interaction(day, eco_metaeco_type),
fill = eco_metaeco_type
)) +
geom_boxplot() +
labs(
x = "Day",
y = "Shannon Index",
fill = "",
caption = "Vertical grey line: resource flow"
) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
) +
scale_fill_manual(
values = c(colour_isolated, colour_same_size, colour_different_size),
labels = c(
"Small isolated",
"Large connected to large",
"Large connected to small"
)
) +
scale_x_continuous(breaks = unique(ds_patches$day)) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
)
p_effect_size = ds_patches_effect_size %>%
filter(
!time_point == 0,
disturbance == disturbance_input,
eco_metaeco_type == "L (L_L)" |
eco_metaeco_type == "L (S_L)"
) %>%
ggplot(aes(x = day,
y = shannon_d,
color = eco_metaeco_type)) +
geom_point(position = position_dodge(0.5)) +
geom_line(position = position_dodge(0.5)) +
geom_errorbar(
aes(ymin = shannon_d_lower,
ymax = shannon_d_upper),
width = .2,
position = position_dodge(0.5)
) +
geom_vline(
xintercept = resource_flow_days[1] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[2] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[3] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[4] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[5] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_vline(
xintercept = resource_flow_days[6] + 0.7,
linetype = "dotdash",
color = "grey",
size = 0.7
) +
geom_hline(
yintercept = 0,
linetype = "dotted",
color = "black",
size = 0.7
) +
scale_x_continuous(breaks = unique(ds_patches_effect_size$day)) +
labs(
x = "Day",
y = "Shannon Index Effect Size (Hedge's d)",
color = ""
) +
scale_color_discrete(labels = c("Large connected to large",
"Large connected to small")) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.position = "bottom"
)
p_effect_size
filtered_data = ds_patches_effect_size %>%
filter(time_point >= first_time_point_model,
time_point <= last_time_point_model,
disturbance == disturbance_input,
eco_metaeco_type %in% c("L (L_L)", "L (S_L)"))
full_model = lm(shannon_d ~
eco_metaeco_type +
eco_metaeco_type : day,
data = filtered_data)
summary(full_model)
##
## Call:
## lm(formula = shannon_d ~ eco_metaeco_type + eco_metaeco_type:day,
## data = filtered_data)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.4059 -0.1794 -0.0370 0.1716 0.4686
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.395785 0.375458 -1.054 0.3226
## eco_metaeco_typeL (S_L) -0.893104 0.530978 -1.682 0.1311
## eco_metaeco_typeL (L_L):day 0.001522 0.019502 0.078 0.9397
## eco_metaeco_typeL (S_L):day 0.047015 0.019502 2.411 0.0425 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.3263 on 8 degrees of freedom
## Multiple R-squared: 0.4275, Adjusted R-squared: 0.2128
## F-statistic: 1.991 on 3 and 8 DF, p-value: 0.194
par(mfrow = c(2,3))
plot(full_model, which = 1:5)
null_model = lm(shannon_d ~
1,
data = filtered_data)
anova = anova(full_model, null_model)
AIC = AIC(full_model, null_model)
anova
## Analysis of Variance Table
##
## Model 1: shannon_d ~ eco_metaeco_type + eco_metaeco_type:day
## Model 2: shannon_d ~ 1
## Res.Df RSS Df Sum of Sq F Pr(>F)
## 1 8 0.8519
## 2 11 1.4880 -3 -0.6361 1.9911 0.194
AIC
## df AIC
## full_model 5 12.31219
## null_model 2 13.00480
p_value = anova$`Pr(>F)`[2]
AIC_full = AIC$AIC[1]
AIC_null = AIC$AIC[2]
deltaAIC = AIC_full - AIC_null
R2_full = glance(full_model)$r.squared
R2_null = glance(null_model)$r.squared
R2_P = R2_full - R2_null
p_value = round(p_value, digits = 2)
R2_full = round(R2_full, digits = 2)
R2_P = round(R2_P, digits = 2)
deltaAIC = round(deltaAIC, digits = 2)
p_effect_size +
labs(title = paste0("ΔAIC = ", deltaAIC, ", p = ", p_value, ", R2 (pach type) = ", R2_P))
We want to know if there was a systematic bias in the evaporation of different treatments (disturbance, patch size) and whether evaporation changed across time. My expectation would be that we would see a difference among the exchanges 2,3 and the exchanges 4,5,6. This is because in exchange 2,3 cultures were microwaved in 15 tubes for 3 minutes and in exchange 4,5,6 cultures were microwaved in 4 tubes for only 1 minute.
#Columns: exchange & evaporation
ds_for_evaporation = gather(ds_for_evaporation,
key = exchange,
value = evaporation,
water_add_after_t2:water_add_after_t6)
ds_for_evaporation[ds_for_evaporation == "water_add_after_t2"] = "2"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t3"] = "3"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t4"] = "4"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t5"] = "5"
ds_for_evaporation[ds_for_evaporation == "water_add_after_t6"] = "6"
ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] = ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] / 2 #This is because exchange contained the topping up of two exchanges
ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] = ds_for_evaporation$evaporation[ds_for_evaporation$exchange == 2] + 2 #We need to add 2 ml to the evaporation that happened at the exchange events 1 and 2. This is because we already added 1 ml of water at exchange 1 and 1 ml of water at exchange 2.
#Column: nr_of_tubes_in_rack
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 1] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 2] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 3] = 15
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 4] = 4
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 5] = 4
ds_for_evaporation$nr_of_tubes_in_rack[ds_for_evaporation$exchange == 6] = 4
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(nr_of_tubes_in_rack),
y = evaporation)) +
geom_boxplot() +
labs(x = "Number of tubes in rack",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(patch_size),
y = evaporation)) +
geom_boxplot() +
labs(x = "Patch size",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = as.character(day),
y = evaporation)) +
geom_boxplot() +
labs(x = "Day",
y = "Evaporation (ml)")
ds_for_evaporation %>%
filter(disturbance == disturbance) %>%
ggplot(aes(x = disturbance,
y = evaporation)) +
geom_boxplot() +
labs(x = "Disturbance",
y = "Evaporation (ml)")
It seems like there is no real difference across time, disturbance, or patch type. However, we could also run a mixed effect model to show that they do not.
It gives me the following error:
mixed.model = lmer(evaporation ~
patch_size * disturbance * exchange +
(exchange | culture_ID),
data = ds_for_evaporation,
REML = FALSE,
control = lmerControl (optimizer = "Nelder_Mead"))
null.model = lm(evaporation ~
1,
data = ds_for_evaporation)
anova(mixed.model, null.model)
evaporation.test = read.csv(here("data", "evaporation_test","evaporation_test_right.csv"), header = TRUE)
evaporation.test %>%
ggplot(aes (x = as.character(water_pipetted),
y = weight_water_evaporated,
group = interaction(water_pipetted, as.character(rack)),
fill = as.character(rack))) +
geom_boxplot() +
labs(x = "Water volume (ml)" ,
y = "Evaporation (g)",
fill = "Rack replicate")
evaporation.test = read.csv(here("data", "evaporation_test", "evaporation_test_fill_nofill.csv"), header = TRUE)
evaporation.test %>%
ggplot(aes (x = all_tubes_water,
y = weight_water_evaporated)) +
geom_boxplot() +
labs(x = "Water in the other 10 tubes" ,
y = "Evaporation (g)",
caption = "When all tubes were filled, they were filled with 6.75 ml of deionised water.")
rm(list = ls())
setwd("/media/mendel-himself/ID_061_Ema2/PatchSizePilot/training")
# load package
# library(devtools)
# install_github("femoerman/bemovi", ref="master")
library(bemovi)
library(parallel)
library(doParallel)
library(foreach)
#Define memory to be allocated
memory.alloc <- 240000 #-needs_to_be_specified
memory.per.identifier <- 40000 #-needs_to_be_specified
memory.per.linker <- 5000 #-needs_to_be_specified
memory.per.overlay <- 60000 #-needs_to_be_specified
# UNIX
# set paths to tools folder and particle linker
tools.path <-
"/home/mendel-himself/bemovi_tools/" #-needs_to_be_specified
to.particlelinker <- tools.path
# directories and file names
to.data <- paste(getwd(), "/", sep = "")
video.description.folder <- "0_video_description/"
video.description.file <- "video_description.txt"
raw.video.folder <- "1_raw/"
raw.avi.folder <- "1a_raw_avi/"
metadata.folder <- "1b_raw_meta/"
particle.data.folder <- "2_particle_data/"
trajectory.data.folder <- "3_trajectory_data/"
temp.overlay.folder <- "4a_temp_overlays/"
overlay.folder <- "4_overlays/"
merged.data.folder <- "5_merged_data/"
ijmacs.folder <- "ijmacs/"
######################################################################
# VIDEO PARAMETERS
# video frame rate (in frames per second)
fps <- 25 #-needs_to_be_specified
# length of video (in frames)
total_frames <- 125 #-needs_to_be_specified
#Dimensions of the videos in pixels
width = 2048 #-needs_to_be_specified
height = 2048 #-needs_to_be_specified
# measured volume (in microliter) #-needs_to_be_specified
measured_volume <-
34.4 # for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
#measured_volume <- 14.9 # for Nikon SMZ1500 with 2 fold magnification, sample height 0.5 mm and Canon 5D Mark III
# size of a pixel (in micrometer) #-needs_to_be_specified
pixel_to_scale <-
4.05 # for Leica M205 C with 1.6 fold magnification, sample height 0.5 mm and Hamamatsu Orca Flash 4
#pixel_to_scale <- 3.79 # for Nikon SMZ1500 with 2 fold magnification, sample height 0.5 mm and Canon 5D Mark III
# specify video file format (one of "avi","cxd","mov","tiff")
# bemovi only works with avi and cxd. other formats are reformated to avi below
video.format <- "cxd" #-needs_to_be_specified
# setup
difference.lag <- 10
thresholds <- c(13, 255) # don't change the second value
# thresholds <- c(50,255)
# MORE PARAMETERS (USUALLY NOT CHANGED)
######################################################################
# FILTERING PARAMETERS
# optimized for Perfex Pro 10 stereomicrocope with Perfex SC38800 (IDS UI-3880LE-M-GL) camera
# tested stereomicroscopes: Perfex Pro 10, Nikon SMZ1500, Leica M205 C
# tested cameras: Perfex SC38800, Canon 5D Mark III, Hamamatsu Orca Flash 4
# tested species: Tet, Col, Pau, Pca, Eug, Chi, Ble, Ceph, Lox, Spi
# min and max size: area in pixels
particle_min_size <- 10
particle_max_size <- 1000
# number of adjacent frames to be considered for linking particles
trajectory_link_range <- 3
# maximum distance a particle can move between two frames
trajectory_displacement <- 16
# these values are in the units defined by the parameters above: fps (seconds), measured_volume (microliters) and pixel_to_scale (micometers)
filter_min_net_disp <- 25
filter_min_duration <- 1
filter_detection_freq <- 0.1
filter_median_step_length <- 3
######################################################################
# VIDEO ANALYSIS
#Check if all tools are installed, and if not install them
check_tools_folder(tools.path)
#Ensure computer has permission to run bftools
system(paste0("chmod a+x ", tools.path, "bftools/bf.sh"))
system(paste0("chmod a+x ", tools.path, "bftools/bfconvert"))
system(paste0("chmod a+x ", tools.path, "bftools/showinf"))
# Convert files to compressed avi (takes approx. 2.25 minutes per video)
convert_to_avi(
to.data,
raw.video.folder,
raw.avi.folder,
metadata.folder,
tools.path,
fps,
video.format
)
# TESTING
# check file format and naming
# check_video_file_names(to.data,raw.avi.folder,video.description.folder,video.description.file)
# check whether the thresholds make sense (set "dark backgroud" and "red")
#check_threshold_values(to.data, raw.avi.folder, ijmacs.folder, 2, difference.lag, thresholds, tools.path, memory.alloc)
# identify particles
locate_and_measure_particles(
to.data,
raw.avi.folder,
particle.data.folder,
difference.lag,
min_size = particle_min_size,
max_size = particle_max_size,
thresholds = thresholds,
tools.path,
memory = memory.alloc,
memory.per.identifier = memory.per.identifier,
max.cores = detectCores() - 1
)
# link the particles
link_particles(
to.data,
particle.data.folder,
trajectory.data.folder,
linkrange = trajectory_link_range,
disp = trajectory_displacement,
start_vid = 1,
memory = memory.alloc,
memory_per_linkerProcess = memory.per.linker,
raw.avi.folder,
max.cores = detectCores() - 1,
max_time = 1
)
# merge info from description file and data
merge_data(
to.data,
particle.data.folder,
trajectory.data.folder,
video.description.folder,
video.description.file,
merged.data.folder
)
# load the merged data
load(paste0(to.data, merged.data.folder, "Master.RData"))
# filter data: minimum net displacement, their duration, the detection frequency and the median step length
trajectory.data.filtered <-
filter_data(
trajectory.data,
filter_min_net_disp,
filter_min_duration,
filter_detection_freq,
filter_median_step_length
)
# summarize trajectory data to individual-based data
morph_mvt <-
summarize_trajectories(
trajectory.data.filtered,
calculate.median = F,
write = T,
to.data,
merged.data.folder
)
# get sample level info
summarize_populations(
trajectory.data.filtered,
morph_mvt,
write = T,
to.data,
merged.data.folder,
video.description.folder,
video.description.file,
total_frames
)
# create overlays for validation
create.subtitle.overlays(
to.data,
traj.data = trajectory.data.filtered,
raw.video.folder,
raw.avi.folder,
temp.overlay.folder,
overlay.folder,
fps,
vid.length = total_frames / fps,
width,
height,
tools.path = tools.path,
overlay.type = "number",
video.format
)
# Create overlays (old method)
create_overlays(
traj.data = trajectory.data.filtered,
to.data = to.data,
merged.data.folder = merged.data.folder,
raw.video.folder = raw.avi.folder,
temp.overlay.folder = "4a_temp_overlays_old/",
overlay.folder = "4_overlays_old/",
width = width,
height = height,
difference.lag = difference.lag,
type = "traj",
predict_spec = F,
contrast.enhancement = 1,
IJ.path = "/home/mendel-himself/bemovi_tools",
memory = memory.alloc,
max.cores = detectCores() - 1,
memory.per.overlay = memory.per.overlay
)
########################################################################
# some cleaning up
#system("rm -r 2_particle_data")
#system("rm -r 3_trajectory_data")
#system("rm -r 4a_temp_overlays")
system("rm -r ijmacs")
########################################################################
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 7 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 7 rows containing missing values (geom_point).
## Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 11 rows containing missing values (geom_point).
## Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 11 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Removed 7 row(s) containing missing values (geom_path).
## Warning: Removed 15 rows containing missing values (geom_point).
## Warning: Removed 14 row(s) containing missing values (geom_path).
## Warning: Removed 15 rows containing missing values (geom_point).
## Removed 14 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 9 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Removed 9 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
## Warning: Removed 9 rows containing missing values (geom_point).
## Removed 8 row(s) containing missing values (geom_path).
## Warning: Removed 8 rows containing missing values (geom_point).
## Warning: Removed 8 row(s) containing missing values (geom_path).
## Warning: Removed 8 rows containing missing values (geom_point).
## Removed 8 row(s) containing missing values (geom_path).
## Warning: Removed 13 rows containing missing values (geom_point).
## Warning: Removed 11 row(s) containing missing values (geom_path).
## Warning: Removed 13 rows containing missing values (geom_point).
## Removed 11 row(s) containing missing values (geom_path).
## Warning: Removed 13 rows containing missing values (geom_point).
## Warning: Removed 11 row(s) containing missing values (geom_path).
## Time difference of 4.474954 mins